nginx - 域名不适用于 nginx 中的某些端口

标签 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 中设置(我知道它通过了 throw nginx,因为它显示在 nginx 访问日志中!),但是我用域名无法访问! (超时) 唯一同时适用于 IP 和域名的端口是 80 和 8080!其他端口不起作用。

我使用 cloudflare 服务作为 DNS。

感谢您的帮助。

最佳答案

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

对于通过 HTTP 发出的请求:

80 8080 8880 2052 2082 2086 2095

对于通过 HTTPS 发出的请求:

443 2053 2083 2087 2096 8443

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

关于nginx - 域名不适用于 nginx 中的某些端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46466731/

相关文章:

ssl - Cloudflare - Terraform - 启用 SSL 完全加密

nginx - 在 nginx 中重定向到主页

ruby-on-rails - 捆绑程序:无法加载命令:puma - Errno::EACCES:权限被拒绝 - 连接(2)

nginx - 哪些 Web 服务器支持 HTTP/2

java - 使用 JNDI 获取 DNS SRV 记录

azure - windows azure网站预览A记录专用IP

ssl - 是否可以通过 CloudFlare 的免费计划免费使用 SendGrid 或铜牌?

docker - 如何在 Alpine linux 上为 nginx 添加 Lua 模块?

ssl - Nginx SSL 信任库/cacert 规范

Phpmailer 发送邮件而无需 SMTP 身份验证