【问题标题】:nginx won't respond on some portsnginx 不会在某些端口上响应
【发布时间】:2018-03-08 03:25:27
【问题描述】:

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

sudo service ufw stop

在可用的站点中,我有一个名为 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

感谢您的帮助和支持

【问题讨论】:

  • 不工作是什么意思?
  • @TarunLalwani 它超时了!或者 chrome 会说:无法访问此站点 boomrang-app.ir 响应时间过长。尝试:检查连接检查代理和防火墙运行 Windows 网络诊断 ERR_CONNECTION_TIMED_OUT
  • 你在 nginx 中看到了什么吗?如果不是,那么这是一个 DNS 问题
  • nginx中没有日志(错误和访问)。它响应端口 8080,所以它不应该是 dns 问题。

标签: django ubuntu nginx uwsgi


【解决方案1】:

我已经解决了这个问题! 问题是我将 cloudflare 用于 dns,而 cloudflare 只允许我使用此处列出的一些端口:

对于通过 HTTP 发出的请求:

80 8080 8880 2052 2082 2086 2095

对于通过 HTTPS 发出的请求:

443 2053 2083 2087 2096 8443

希望它可以帮助其他面临此问题的人!

【讨论】:

    猜你喜欢
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-30
    • 2019-04-06
    • 1970-01-01
    • 2018-11-10
    相关资源
    最近更新 更多