sever block 수정 하여 해결
-변경 전
server {
listen 80;
server_name mywebsite.com;
root /home/user/public_html/mywebsite.com/public;
access_log /home/user/public_html/mywebsite.com/log/access.log upstreamlog;
error_log /home/user/public_html/mywebsite.com/log/error.log;
location / {
proxy_pass http://xxx.xxx.xxx.xxx:8001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Probably can add a few more line to increase the timeout period to upstream. The examples below sets the timeout to 300 seconds :
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
-변경 후
server {
listen 80;
server_name mywebsite.com;
root /home/user/public_html/mywebsite.com/public;
access_log /home/user/public_html/mywebsite.com/log/access.log upstreamlog;
error_log /home/user/public_html/mywebsite.com/log/error.log;
location / {
proxy_pass http://xxx.xxx.xxx.xxx:8001;
proxy_redirect off;
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_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
}
}
Reffernce
https://stackoverflow.com/questions/24453388/nginx-reverse-proxy-causing-504-gateway-timeout
728x90
반응형
댓글