Nginx SSL 配置不起作用,为什么?

Nginx SSL 配置不起作用,为什么?

nginx 1.10.1在 Windows Server 2012 R2 上运行,并且刚刚从 GoDaddy 购买并安装了 SSL 证书。

我已将配置更改为我认为应该的样子,但它不起作用。网站仍在运行http,但我在超时时收到超时信息https。我希望这是我忽略的一些非常简单的事情。这是我第一次尝试使用安装 SSL 证书nginx

nginx.conf

worker_processes 1;

events {
    worker_connections 1024;
}

http {
    server_tokens off;
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    # http://stackoverflow.com/questions/12640014/enable-gzip-for-css-and-js-files-on-nginx-server-for-magento
    gzip on;
    gzip_comp_level 6;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_proxied any;
    gzip_types
        text/plain
        text/css
        text/js
        text/xml
        text/javascript
        application/javascript
        application/x-javascript
        application/json
        application/xml
        application/rss+xml
        image/x-icon
        image/svg+xml;

    # http://nginx.org/en/docs/http/server_names.html
    server_names_hash_bucket_size 64;

    server {
        listen      80;
        server_name localhost;
        access_log  logs/host.access.log;
        error_page  404 /404.html;
        error_page  500 502 503 504 /50x.html;

        location / {
            root   html;
            index  index.html index.htm;
        }
        location = /50x.html {
            root   html;
        }
    }

    include websites/*.conf;
}

/websites/domain-co-uk.conf

server {
    server_name domain.co.uk;
    return 301  $scheme://www.domain.co.uk$request_uri;
}

server {
    listen              80;
    listen              443 ssl;
    server_name         www.domain.co.uk;

    ssl_certificate     /nginx/conf/ssl/domain-co-uk/1234.crt;
    ssl_certificate_key /nginx/conf/ssl/domain-co-uk/domain.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;

    access_log          logs/domain-co-uk-access.log;
    charset             utf-8;
    location / {
        proxy_pass http://localhost:4008/;
    }
}

我在日志中看不到任何问题。

网站:

参观https://www.thepreventduty.co.uk/服务器本身就可以工作。

为什么该https版本无法在外部运行..?

答案1

您已对端口 443 实施防火墙。请打开此端口。

答案2

您必须设置 listen 443 ssl;

相关内容