apache
apache的404文件设置 http://www.programgo.com/article/56124827194/
因所有网站服务器都要迁移,更换IP。要发网站停机维护公告,所以需把首页和404错误都指向index.html文件
临时服务器上,apache的网站根目录下只放一个停机维护公告文件index.html
修改apache的配置文件,把404报错文件指向 http://www.test.com/index.html,即设置
修改apache的配置文件,把404报错文件指向 http://www.test.com/index.html,即设置
1 2 3 |
vim vim /etc/httpd/conf/httpd.conf ErrorDocument 404 http://www.test.com/index.html ErrorDocument 503 /error.html |
把网站的域名的DNS都指向此服务器IP即可。生效后,停服,迁移。待迁移完毕,再修改DNS指向
nginx
默认错误文件位置: /usr/share/nginx/html/
全局配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
mkdir -p /usr/share/nginx/html/error #然后上传502文件到这里 vim /etc/nginx/conf.d/wx.conf server { listen 80; server_name wx.abc.cn; location / { proxy_pass http://xxxxxxxx:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Remote_Addr $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Cookie $http_cookie; add_header From wx.abc.cn; proxy_cookie_path /abc/ /; proxy_cookie_path /abc /; client_max_body_size 1000m; #error_page 502 503 504 http://www.baidu.com/error.html;#页面会跳转 error_page 502 503 504 /error/502.html; #在原有域名请求连接页面展示 } location /error { root /usr/share/nginx/html; } } |