1.服务器磁盘空间满,nginx日志清理
目录:/var/autodelnginxlog.sh
可以调整脚本里面的天数,比如将7天改成2天,然后运行脚本一次
2.链接映射:
120.55.54.219服务器找到路径文件:
/etc/nginx/conf.d/xxxx.conf
参考样例修改
location /v2/custom-product {
if ($query_string ~* ^(.*)activityCode=JP2020072318332365285&ch=KE_PUSH_XLY){
set $args '';
rewrite ^/v2/custom-product(.*) https://host/course?courseCode=JP2019082211184552432&ch=KE_PUSH_XLY permanent;
}
try_files $uri $uri/ /v2/index.html;
}
3. 伪静态配置
# https://www.host.com/article-insure-JP2019101214274952259.html
# will rewrite to
# https://www.host.com/article.htmlpage=insure&articleCode=JP2019101214274952259.html
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
index index.html;
rewrite ^/article-([^-]+)-([^-]+)-([^-]+)\.html$ /article.html break;
#return 200 "[X] $request_uri -> $uri?$args";
}
4.如何排查线上问题
方法一:error.log 通过报错信息
2020-05-21 13:52:00,885 [49c5913e29e2] [http-nio-8072-exec-6] ERROR com.xxx.cms.config.ExceptionAdvice.java:22 - Exception Advice catch error:
java.lang.NullPointerException: null
如果已经被压缩到zip里面,使用 gzip -dc /opt/logs/web/app.log | grep 49c5913e29e2
方法二:app.log 用户尝试再次触发报错
找到接口关键字 方法名、参数值等
tail -f /opt/logs/web-api/app.log | grep --line-buffer 1039006
2020-05-21 13:59:30,675 [f68bf59f2c7d] [http-nio-8074-exec-8] INFO com.xxx.web.config.WebLogAspect.java:63 - WebLogAspect POST : http://host.com/api/course/v2/list, ARGS : [{"courseType":"1039006","firstPurchase":false,"pageNum":1,"pageSize":10,"realSearch":false}]