nginx不会在某些端口上响应

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

我的问题是我无法在现有的nginx配置中添加另一个端口。我使用以下命令禁用了ubuntu服务器上的防火墙:

sudo service ufw stop

在sites-available中我有一个名为file.conf的文件:

server {
listen 80;
server_name example.com example.com;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/user/project;
}

location /files/ {
    root /home/user/download/;
}
}
server{
    listen 8080;
    server_name example.com www.example.com;
        location / {
    include         uwsgi_params;
    uwsgi_pass      unix:/run/uwsgi/project.sock;
}
}
server{
    listen 8001;
    server_name example.com www.example.com;

location / {
    include         uwsgi_params;
    uwsgi_pass      unix:/run/uwsgi/project.sock;
}
}

我之前有8080部分,这在过去和现在都有效,但是8001没有用。我禁用了防火墙,所以我认为问题出在其他地方。

我也运行了这个命令:

 sudo netstat -napl | grep 8001

返回了这个:

tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN      3475/nginx -g daemo

感谢您的帮助和支持

django ubuntu nginx uwsgi
1个回答
2
投票

我已经解决了这个问题!问题是我使用cloudflare for dns和cloudflare只让我使用这里列出的一些端口:

对于通过HTTP发出的请求:

80 8080 8880 2052 2082 2086 2095

对于通过HTTPS发出的请求:

443 2053 2083 2087 2096 8443

希望它能帮助其他人面对这个问题!

© www.soinside.com 2019 - 2024. All rights reserved.