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

歡迎來到云服務(wù)器

服務(wù)器租用

nginx利用error_page指令的留意事項(xiàng)

        nginxerror_page對付同一個(gè)http狀態(tài)碼,莫斯科服務(wù)器 新加坡vps,只能執(zhí)行一次,第二次就不會(huì)再執(zhí)行了(初認(rèn)識(shí)有錯(cuò)誤)。

       譬喻:403狀態(tài)

       下面這段代碼,假如會(huì)見呈現(xiàn)403,會(huì)跳到retry段,在沒有,就會(huì)直接呈現(xiàn)403,而不會(huì)跳到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;

          }

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

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刪除了,匹配到/,會(huì)呈現(xiàn)403,再跳到retry中,利用lua返回401的狀態(tài)碼,看error_page是否能跳轉(zhuǎn)到http://news.17173.com/game/yzdzh.shtml?

       驗(yàn)證:

nginx利用error_page指令的留意事項(xiàng)

       看來error_page在一次請求中,只能利用一次,無關(guān)狀態(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;

}

       會(huì)見就會(huì)直接跳轉(zhuǎn)到j(luò)d.com。

nginx利用error_page指令的留意事項(xiàng)

騰訊云代理

Copyright © 2003-2021 MFISP.COM. 國外vps服務(wù)器租用 夢飛云服務(wù)器租用 版權(quán)所有 ? 粵ICP備11019662號(hào)

主站蜘蛛池模板: 喜德县| 鄂州市| 娄底市| 赤城县| 南宫市| 泰和县| 登封市| 岢岚县| 新闻| 六盘水市| 定安县| 鲜城| 秀山| 长海县| 武汉市| 珠海市| 东源县| 朝阳区| 红桥区| 浪卡子县| 长汀县| 辉南县| 泰来县| 安新县| 日土县| 镇康县| 勐海县| 滕州市| 综艺| 福建省| 阿克苏市| 和静县| 湘西| 增城市| 玛曲县| 南城县| 恩平市| 新乡县| 兴山县| 开封市| 潜山县|