域名不适用于nginx

时间:2017-09-28 10:21:44

标签: nginx dns cloudflare

我使用此配置在我的ubuntu服务器中使用nginx:

server {
listen 80;
server_name example.ir www.example.ir;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/user/project;
}
location /download {
    rewrite ^/download$
http://example.ir/files/file.apk;
}
location /download/ {
    rewrite ^/download/$
http://example.ir/files/file.apk;
}
location /files/ {
    root /home/user/download/;
}
}



server{
    listen 8585;
    server_name example.ir www.example.ir;
        location / {
    include uwsgi_params;
    uwsgi_pass unix:/run/uwsgi/project.sock;
}
}

我可以使用IP(1.2.3.4:8585)访问该站点(在django中),虽然它没有在nginx中设置(我知道它通过了抛出nginx,因为它出现在nginx访问日志中!),但我无法使用域名访问它! (它超时) 唯一适用于ip和域名的端口是80和8080!其他端口不起作用。

我为dns使用cloudflare服务。

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

cloudflare只允许您使用此处列出的某些特定端口:

对于通过HTTP发出的请求:

80 8080 8880 2052 2082 2086 2095

对于通过HTTPS发出的请求:

443 2053 2083 2087 2096 8443

您可以使用8880代替8585或更改您的DNS服务。

相关问题