nginx 定义502 404 错误提示页面
2009-06-05 15:45
661 查看
nginx 定义502 404 错误提示页面
[align=left]nginx 与后端 web server 是分开的,二台服务器[/align][align=left] [/align]
[align=left]192.168.1.11 Nginx[/align]
[align=left]192.168.1.12 Web server[/align]
[align=left] [/align]
[align=left]定义nginx 404 502错误提示页面,直接配置nginx 502错误,找了很多资料,最终没能实现。下面用另一个方法实现.[/align]
[align=left] [/align]
方法一、
[align=left]在nginx.conf配置文件里加上以下红色代码[/align][align=left] [/align]
erver
{
listen 80;
server_name www.tt.com;
location / {
proxy_pass http://week; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if (!-f $request_filename) {
proxy_pass http://127.0.0.1:8888; }
}
17.0.0.1:8888配置如下
erver
{
listen 8888;
server_name www.tt.com;
location / {
root /root;
index index.html;
error_page 500 502 404 /404.html;
}
}
需要维护的时候,只需要重启nginx服务。
kill -HUP 'cat logs/nginx.pid'
方法二、
单独创建一个testnginx.conf文件#user nobody;
worker_processes 1;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 50000;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server
{
listen 80;
server_name www.tt.com;
location / {
root /root;
index index.html;
error_page 500 502 404 /404.html;
}
}
}
维护时只需把nginx停止,从新启用新的配置文件
killall -9 nginx
nginx -c ../conf/testnginx.conf本文出自 “网海过客” 博客,请务必保留此出处http://cqfish.blog.51cto.com/622299/163238
相关文章推荐
- nginx 设置错误的自己定义404页面跳转到500
- nginx和tomcat做整合,nginx代理访问tomcat页面,一级页面能访问,但是二级页面提示404错误。
- nginx-502错误,老是提示busy.优化php-fpm如下
- nginx 设置错误的自定义404页面跳转到500
- 404错误、500错误、异常错误提示页面的拦截和自定义
- NGINX 配置404错误页面转向
- NGINX下配置404错误页面的方法
- Nginx出现502和504错误提示的解决方案
- NGINX 配置404错误页面转向
- Nginx出现“ 413 (499 502 404) Request Entity Too Large”错误解决方法
- NGINX 配置404错误页面转向
- 为Nginx制作404 403 500等错误页面
- Nginx基础入门之网站路径定义及错误提示重定向
- NGINX 配置404错误页面转向
- Nginx配置error_page 404 500等自定义的错误页面
- nginx 设置错误的自定义404页面跳转到500
- NGINX 配置404错误页面转向
- nginx 404 403等错误信息页面重定向到网站首页或其它事先指定的页面
- NGINX 配置404错误页面转向
- IIS:打开任意 .aspx 页面,提示 404 错误