查看nginx错误日志:
$ cat /var/log/nginx/error.log
[error] ...upstream timed out (110: Connection timed out) while reading response header from upstream...client: ..., server: ...,
这种情况是我们在使用nginx做反向代理,访问接口时报错,代码为504,是代理超时问题造成的。
需要修改nginx.conf ,
我的nginx配置:
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
}
修改为:
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_read_timeout 600;
uwsgi_send_timeout 600;
uwsgi_connect_timeout 600;
}
然后重启nginx:
sudo service nginx reload
重启后依然有错误,日志显示:
signal process started
此时查看nginx服务进程:
ps -ef | grep nginx
pkill -9 nginx #杀死nginx服务进程
再次重启,成功!