1.服務(wù)器磁盤空間滿,nginx日志清理
目錄:/var/autodelnginxlog.sh
可以調(diào)整腳本里面的天數(shù),比如將7天改成2天,然后運行腳本一次
2.鏈接映射:
120.55.54.219服務(wù)器找到路徑文件:
/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. 偽靜態(tài)配置
# 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
如果已經(jīng)被壓縮到zip里面,使用 gzip -dc?/opt/logs/web/app.log | grep?49c5913e29e2
方法二:app.log 用戶嘗試再次觸發(fā)報錯
找到接口關(guān)鍵字 方法名、參數(shù)值等
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}]