nginx自定義404、403頁面


 

1、在nginx的http模塊加入:

fastcgi_intercept_errors on;

2、在server模塊加入

location / {
        root   /data;
        index  index.html index.htm yunmai.html;
        error_page   403  /403.html;
        error_page   404  /404.html;
    location = /403.html {
        root   /usr/share/nginx/html;
    }
    location = /404.html {
        root   /usr/share/nginx/html;
    }

3、編輯以下路徑下的自定義頁面

4、重載nginx

nginx -s reload

  

參考:https://blog.51cto.com/hunkz/1840200


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM