./nginx -t 檢測(cè)nginx.conf文件是否正確
./nginx -c /xx/xx/xx/nginx.conf 指定對(duì)應(yīng)的nginx.conf文件
nginx未匹配到路由定罢,會(huì)默認(rèn)跳轉(zhuǎn)到 404頁(yè)面逗抑,增加以下配置可以將404頁(yè)面重定向到我們指定的 404.html
location / {
proxy_intercept_errors on; //該參數(shù)必須配置
}
error_page 404 /404.html;
location = /404.html {
root /zz/nginx
} // /zz/nginx/404.html這個(gè)路徑下404.html必須存在