关于nginx504超时解决方法

解决过程:

1.查阅资料后,觉得可能是nginx代理超时,将nginx.conf或者vhost中的配置文件中加入设置的代理时长,结果还是没起作用:
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;

2.最后设置了fastcgi的超时配置,重启nginx.
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
发现还不行

3、查看了django_nginx.conf

server {
listen 8000;
server_name 0.0.0.0;
access_log /var/log/nginx/mysite_access.log;
error_log /var/log/nginx/mysite_error.log;
charset utf-8;
keepalive_timeout 65;
client_max_body_size 75M;
root /data/jenkins/mysite;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9001;
uwsgi_read_timeout 2; #发现这个值比较小
}
location /static/ {
expires 30d;
autoindex on;
add_header Cache-Control private;
alias /data/jenkins/mysite/static/;
}

location /media/ {
expires 30d;
autoindex on;
add_header Cache-Control private;
alias /data/jenkins/mysite/media/;
}
}

将此值修改为300后,再次请求,OK了

你可能感兴趣的:(nginx)