nginx windows 清理日誌文件

今天在訪問我的站點時發現一些 css , js 靜態文件加載失敗:net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)

經排查,有可能是 nginx 代理出現故障,遂去查看日誌文件,發現 nignx/logs 下的 access.log 文件達800m。直接打開是不行了,看看能否清空日誌,重新訪問一下站點,再看最新的日誌。

1. 我嘗試刪除日誌,右鍵日誌文件,刪除:沒有權限操作

2. 訪問 http://nginx.org/en/docs/windows.html 看看有沒有日誌操作方面的命令,果然有:

 

ginx/Windows runs as a standard console application (not a service), and it can be managed using the following commands:

nginx -s stop	fast shutdown
nginx -s quit	graceful shutdown
nginx -s reload	changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reopen	re-opening log files

於是我用 nginx -s reopen 來重新打開日誌文件,仍提醒沒有權限

按本人經驗,我先把 nginx 服務關閉,nginx -s quit 再 nginx -s reopen 再啓動 nginx 日誌文件大小果然清空了。

接下來,我就可以繼續排查問題了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章