设置Nginx 404页面

来源:互联网 发布:m3轮毂数据 编辑:程序博客网 时间:2024/05/17 01:41

 from 

http://blog.sina.com.cn/s/blog_60be437a0100jp99.html


1.创建自己的404.html页面

2.更改nginx.conf在http定义区域加入:

fastcgi_intercept_errors on;

3.更改nginx.conf在server 区域加入:

error_page 404 = /404.html

4.测试nginx.conf正确性:

/opt/nginx/sbin/nginx –t

如果正确应该显示如下信息:

the configuration file /opt/nginx/conf/nginx.conf syntax is ok
configuration file /opt/nginx/conf/nginx.conf test is successful

 

5.重启nginx.

 

OK

原创粉丝点击