當虛擬主機中不存在主資料夾時,nginx 靜默日誌錯誤

當虛擬主機中不存在主資料夾時,nginx 靜默日誌錯誤

我的網站有一個簡單的設定:當根路徑不存在時:/var/www/apps/mysite nginx 不會記錄該錯誤

server {

        root /var/www/apps/mysite;
        index index.html;

        server_name mysite.com;
        (... more code)

我只能看到:

/var/log/nginx/error.log

只是錯誤(當我的路徑正確時,錯誤如找不到文件)

2018/03/23 09:20:36 [error] 18693#18693: *1246 open() "/var/www/apps/mysite/dev/translations.json" failed (2: No such file or directory), client: 78.216.64.172, server: myserver.com, request: "GET /locales/dev/translations.json HTTP/1.1"....
2018/03/23 09:23:09 [notice] 22716#22716: signal process started
common errors when the page is not found;

我嘗試過: nginx -t ,但沒有顯示錯誤,當然,當我更改路徑時,我的網站可以工作,但尚不清楚。 ngins 如何處理錯誤?在 Apache 中,您需要為每個虛擬主機檔案設定日誌,在 nginx 中,當您沒有設定時,會尋找未找到的檔案的日誌,並且有全域檔案日誌。

相關內容