# Nginx

Nginx 504 Gateway Time-out

背景

Nginx + Tomcat搭建的服务器,客户反映在在访问系统过程中会出现504 Gateway Timeout的错误,出现的频率还不低,但看上去并没什么规律。

Nginx代理配置如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
upstream test {
server 192.168.0.28:9087 weight=1;
}

server {
listen 81;
server_name localhost;
charset utf-8;

location / {
proxy_pass http://test;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}