EC2 Django 实例 ERR_ADDRESS_UNREACHABLE 来自外部

问题描述 投票:0回答:0

我有一个使用 NGinx 和 Gunicorn 的 EC2 实例。

Nginx 运行良好。

Gunicorn 运行良好。

Django 应用程序运行良好。

当我

curl -v 127.0.0.1:80
在机器上时,我收到主页。好的。

但是当我

curl -v public_ip_address:80
curl -v public_dns_address:80
我得到无法到达的错误。

所以我简化了我的 nginx 配置

server {
    listen 80;
    server_name my_public_dns my_public_ip;
    return 200;
}

将错误减少到最低程度。

还是一样的错误

我的 iptable :

sudo iptables -vnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    6   340 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 flags:0x17/0x02 ctstate NEW
    2   120 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8080 flags:0x17/0x02 ctstate NEW

EC2实例的安全组明显开放了80端口

防火墙没问题

sudo ufw status verbose
Status: inactive

远程登录:

telnet my_public_dns 80
Trying my_public_ip...
telnet: Unable to connect to remote host: No route to host

所以好像不是firewall,port,nginx,gunicorn的一些错误。 几天前我还在苦苦挣扎。

django amazon-web-services amazon-ec2
© www.soinside.com 2019 - 2024. All rights reserved.