来自 AWS EC2 上重新定位实例的 502 错误网关

来自 AWS EC2 上重新定位实例的 502 错误网关

我尝试将一些实例从东京地区(顺便说一下,它运行正常)移动到圣保罗地区,然后我跟着这个基本步骤执行,但当我从生成的 AMI 启动实例并打开时,它显示“502错误的网关“浏览器中的消息。

该迁移服务器上的主要组件有:nginx、uwsgi、django、supervisor、new relic。

此重新定位的服务器的所有配置都是相同的,因此我重新启动了所有服务,看起来 nginx 运行良好,但是它有一个详细信息要应用下一个配置,即我的网站的配置文件:

nginx/站点可用/mysite

server {
    listen 80;
    server_name mysite.com;

    access_log /var/log/nginx/site_access.log;
    error_log /var/log/nginx/site_error.log;

    location /static {
        alias  /home/ubuntu/apps/site/static/;
    }

    location /media/  {
        alias /home/ubuntu/apps/site/media/;
    }

    location / {
    client_max_body_size 400M;
    proxy_read_timeout 120;
        proxy_connect_timeout 120;
    proxy_set_header Host $http_host; 
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Client-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://127.0.0.1:8888;
    proxy_buffering off;
    }
}

说实话,我以为它会正常运行,因为http://127.0.0.1:8888工作中但我不明白为什么 nginx 连接中断,我需要一些帮助,以便我可以进行更多研究。我检查了日志文件,根据此文件:

/var/log/nginx/site_error.log

2015/04/06 15:34:31 [error] 832#0: *12 connect() failed (111: Connection refused)
while connecting to upstream, client:
190.233.157.2, server: mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream:
"http://127.0.0.1:8888/favicon.ico", host: "54.207.136.99"

我将再次验证该连接,它向我显示的内容为:

$ ping 127.0.0.1

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.035 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.028 ms
64 bytes from 127.0.0.1: icmp_req=3 ttl=64 time=0.028 ms
64 bytes from 127.0.0.1: icmp_req=4 ttl=64 time=0.026 ms
--- 127.0.0.1 ping statistics ---

然后我尝试使用 curl,大约 30 秒后,它打印出以下内容:

$ curl 127.0.0.1:8888

curl: (56) Recv failure: Connection reset by peer

我遇到了这个奇怪的错误,它到底意味着什么?

相关内容