我正在尝试启动Python网络应用程序,其操作与往常一样(并不是我完全知道自己在做什么)。通常,当我在服务器上运行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
在服务器上时,我得到了我期望的错误网关,但是在我的本地计算机上,我得到了超时。