欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到云服務器

服務器租用

nginx使用error_page指令的注意事項

        nginxerror_page對付同一個http狀態(tài)碼,directadmin安裝 directadmin漢化,只能執(zhí)行一次,第二次就不會再執(zhí)行了(初認識有錯誤)。

       譬喻:403狀態(tài)

       下面這段代碼,假如會見呈現(xiàn)403,會跳到retry段,在沒有,就會直接呈現(xiàn)403,而不會跳到http://www.server110.com/download/error403.html。

              location @retry  {

#return 409;

root   /data1/;

index  index.html index.htm;

error_page 403    http://www.server110.com/download/error403.html;

          }

          location / {

root   /data/;

              index  index.html index.htm;

error_page 403 = @retry ;

error_page 404 =   http://www.server110.com;

          }

本日有做了個測試,假如利用lua把狀態(tài)碼改成此外,再利用error_page,會不會可以呢?

location @retry {

#       return 409;

root /data/www;

index index.html   index.htm index.php;

          content_by_lua '

return   ngx.exit(410);

        ';

error_page 404 =   http://www.baidu.com;

error_page 403 =   http://danhuaer.com/;

error_page 410 = http://news.17173.com/game/yzdzh.shtml;

}

                location / {

root  /data/www/www;

index index.html   index.htm index.php;

error_page 403 =   @retry;

error_page 404 =   http://www.server110.com;

                  }

       我把/data/www/www目次下的index.html刪除了,匹配到/,會呈現(xiàn)403,再跳到retry中,利用lua返回401的狀態(tài)碼,看error_page是否能跳轉(zhuǎn)到http://news.17173.com/game/yzdzh.shtml?

       驗證:

nginx使用error_page指令的注意事項

       看來error_page在一次請求中,只能利用一次,無關狀態(tài)碼是否溝通。

       不能利用error_page,怎么才氣把nginx的狀態(tài)碼不讓用戶看的,而是可以直接跳到指定的頁面?

       雖然是利用lua就行跳轉(zhuǎn)了

location @retry {

#       return 409;

root /data/www;

index index.html   index.htm index.php;

          content_by_lua '

--return   ngx.exit(410);

ngx.redirect("http://jd.com", 302);

        ';

error_page 404 =   http://www.baidu.com;

error_page 403 =   http://danhuaer.com/;

error_page 410 =   http://news.17173.com/game/yzdzh.shtml;

}

                location / {

root  /data/www/www;

index index.html   index.htm index.php;

error_page 403 =   @retry;

error_page 404 =   http://dl.pconline.com.cn;

}

       會見就會直接跳轉(zhuǎn)到jd.com。

nginx使用error_page指令的注意事項

騰訊云代理

Copyright © 2003-2021 MFISP.COM. 國外vps服務器租用 夢飛云服務器租用 版權所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 遂宁市| 广汉市| 福泉市| 东乡| 武邑县| 荔波县| 大名县| 仙桃市| 随州市| 固原市| 沈丘县| 互助| 淮南市| 电白县| 和政县| 东明县| 志丹县| 多伦县| 信阳市| 河北区| 庆云县| 沅江市| 丽江市| 泽普县| 伊宁市| 尉犁县| 仁怀市| 惠州市| 济宁市| 高唐县| 金溪县| 宝清县| 彩票| 白朗县| 明溪县| 永济市| 谷城县| 临猗县| 抚州市| 麟游县| 阳春市|