来自外部源的连接超时呼叫

时间:2019-11-28 19:25:23

标签: docker nginx

我具有以下nginx配置:

server {
    listen 80;
    server_name _;
    server_tokens off;

    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name _;
    server_tokens off;

    ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    location / {
        proxy_pass  http://example.org;
        proxy_set_header    Host                $http_host;
        proxy_set_header    X-Real-IP           $remote_addr;
        proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    }
}

我正在docker容器中运行nginx,它可以正常启动。当我执行:curl localhost时,我收到301 Moved Permanently。但是,当我尝试从外部来源curl publicIP拨打电话时,我收到Timed out

我首先想到的是问题出在防火墙上,但是如果我启动一个没有任何配置的nginx容器curl publicIP可以正常工作,那么我会收到200。

您能帮我弄清楚nginx配置是否存在问题吗?

谢谢

0 个答案:

没有答案