无法在 ubuntu AWS EC2 服务器上访问 nginx



我正在尝试启动一个Python Web应用程序,做与往常相同的操作(并不是说我完全知道我在做什么(。通常,当我在服务器上运行nginx时,我会看到"错误的网关",然后转到浏览器中的IP。无论出于何种原因,我现在都

超时了。编辑:我期待一个坏的网关,我什么也得不到

提前感谢,

我没有对默认配置文件做任何事情... 我的etc/nginx/sites-available/default看起来像这样

server {
listen 80;
server_name ec2-52-36-167-131.us-west-2.compute.amazonaws.com;
access_log  /var/log/nginx/test.log;
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

sudo service nginx status看起来像这样

● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-06-19 02:06:09 UTC; 8s ago
Docs: man:nginx(8)
Process: 9149 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 9161 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 9152 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 9162 (nginx)
Tasks: 2 (limit: 1152)
CGroup: /system.slice/nginx.service
├─9162 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─9163 nginx: worker process
Jun 19 02:06:09 ip-172-31-25-6 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Jun 19 02:06:09 ip-172-31-25-6 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 19 02:06:09 ip-172-31-25-6 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Jun 19 02:06:09 ip-172-31-25-6 systemd[1]: Started A high performance web server and a reverse proxy server.

当我在服务器上curl -I ec2-52-36-167-131.us-west-2.compute.amazonaws.com时,我得到了我期望的错误网关,但在本地计算机上我得到了超时。

已解决,这是 AWS 安全组中的一个问题。

在这里找到它:Ubuntu 18 上的 nginx 网站未在公共 IP 上加载

最新更新