天天看點

linux nginx 404錯誤頁面設定

配置nginx 實作404錯誤 傳回一個頁面

1、配置nginx.conf 

在http代碼塊 添加

fastcgi_intercept_errors on;      

 2、在網站的sever代碼塊 添加

error_page 404  /404.htm;      
/404.htm 指向網站的404錯誤頁面即可      

3、重新開機nginx

#檢測配置是否正确
nginx -t 

#重新開機
nginx -s reload      

轉載于:https://www.cnblogs.com/longlonglong/p/7567012.html