Nginx error_page 自訂錯誤版面設定代碼教程,nginxerror_page

來源:互聯網
上載者:User

Nginx error_page 自訂錯誤版面設定代碼教程,nginxerror_page
Nginx error_page 自訂錯誤版面設定代碼教程

#fastcgi_intercept_errors on;    #文法:fastcgi_intercept_errors on|off     #預設值:fastcgi_intercept_errors off     #使用欄位:http, server, location     #這個指令指定是否傳遞4xx和5xx錯誤資訊到用戶端,或者允許nginx使用error_page處理錯誤資訊。    #你必須明確的在error_page中指定處理方法使這個參數有效,正如Igor所說“如果沒有適當的處理方法,    #nginx不會攔截一個錯誤,這個錯誤不會顯示自己的預設頁面,這裡允許通過某些方法攔截錯誤。    #proxy_intercept_errors 為on 表示 nginx按照原response    #proxy_intercept_errors on|off     #proxy_intercept_errors off     #使用欄位:http, server, location    #code輸出,後端是404,就是404.這個變數開啟後,我們才能自訂錯誤頁面。    proxy_intercept_errors on;    upstream dev1 {        server 127.0.0.1:8080;          #HessianTest3    }    server {        listen       80;        server_name  kevin.com;        location / {            proxy_pass https://dev1;     #HessianTest3        }        #參考書本第40頁        #error_page 404 =200 /404.html;        #error_page 500 502 503 504  =200 /50x.html;        #location = /404.html {        #   root html;        #           #}        #location = /50x.html {        #    root   html;        #}        #當頁面發生異常的時候可以指定跳轉到location中,也可以指定跳轉到指定的URL地址上面        error_page 404 https://www.baidu.com/;    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.