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

歡迎來到夢飛科技

服務器租用

當前優惠活動:

nginx利用error_page指令的留意事項

        nginxerror_page對付同一個http狀態碼,莫斯科服務器 新加坡vps,只能執行一次,第二次就不會再執行了(初認識有錯誤)。

       譬喻:403狀態

       下面這段代碼,假如會見呈現403,會跳到retry段,在沒有,就會直接呈現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把狀態碼改成此外,再利用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刪除了,匹配到/,會呈現403,再跳到retry中,利用lua返回401的狀態碼,看error_page是否能跳轉到http://news.17173.com/game/yzdzh.shtml?

       驗證:

nginx操作error_page指令的寄望事項

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

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

       雖然是利用lua就行跳轉了

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;

}

       會見就會直接跳轉到jd.com。

nginx操作error_page指令的寄望事項

夢飛科技 - 全球數據中心基礎服務領先供應商

Copyright © 2003-2019 MFISP.COM. 國外服務器租用 IDC公司 版權所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 余姚市| 辽宁省| 张家港市| 当雄县| 贵溪市| 甘谷县| 浠水县| 玉溪市| 筠连县| 太湖县| 鹤岗市| 碌曲县| 凉城县| 弥渡县| 纳雍县| 珲春市| 宜章县| 巨鹿县| 天津市| 绥芬河市| 江津市| 灵川县| 阿巴嘎旗| 贵德县| 平乐县| 玉林市| 日照市| 邵阳县| 绥德县| 苗栗市| 克拉玛依市| 柯坪县| 达孜县| 新建县| 宝清县| 乌恰县| 稻城县| 绥芬河市| 邳州市| 大英县| 闽侯县|