本文介绍了nginx烧瓶aws 502 Bad Gateway的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器昨天运行良好,但现在返回了502错误,这怎么可能?

My server is running great yesterday but now it returned a 502 error, how could this happen?

在我的access.log中显示:

In my access.log shows:

[24/Aug/2016:07:40:29 +0000] "GET /ad/image/414 HTTP/1.1" 502 583 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"

在我的error.log中显示:

In my error.log shows:

2016/08/24 07:38:50 [error] 14465#0: *12513 connect() failed (111: Connection refused) while connecting to upstream, client: 123.49.616.74, server: app.example.com.au, request: "GET /ad/image/414 HTTP/1.1", upstream: "http://127.0.0.1:8000/ad/image/414", host: "app.example.com.au"

这是我运行grep时的结果:

This is the result when I run grep:

ubuntu    6856  0.0  0.6  56624 12652 ?        S    00:08   0:03 /home/www/carbuzzz_admin/env/bin/python /home/www/carbuzzz_admin/env/bin/gunicorn application:application -b localhost:4215
ubuntu    6865  0.0  1.8 180832 36892 ?        S    00:08   0:00 /home/www/carbuzzz_admin/env/bin/python /home/www/carbuzzz_admin/env/bin/gunicorn application:application -b localhost:4215
ubuntu   14300  0.0  0.0  10464   948 pts/0    S+   08:06   0:00 grep --color=auto -i gunicorn

推荐答案

HTTP状态代码502通常表示Nginx代理的应用程序服务器未运行.因为这是一个Flask应用程序,所以我认为它就像Gunicorn或uwsgi.检查它是否正在运行.

The HTTP status code 502 normally means that the application server Nginx is proxying to is not running. As this is a Flask app I presume this is something like Gunicorn or uwsgi. Check to see if that is running.

我通常使用Supervisor之类的工具来确保应用程序服务器在出现故障时自动重新启动.

I normally use something like Supervisor to ensure that the application server gets restarted automatically if it goes down.

这篇关于nginx烧瓶aws 502 Bad Gateway的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-22 23:55