nginx error_page的配置


error_page可以配置在http、server、location块;

 

1. 跳转

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

 

2. 重定向

我尝试把页面放到别的路径下,但是error日志显示,error.html只能放在nginx/html目录下,查看官方文档也没有其他方法。

error_page 404 =200 /error.html;

 

3.@符号指定到location的url上

error_page 404 @another_url;
        location @another_url {
            root /home/wc/nginx.d;
        }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM