Nginx SSL config not working, why?

Stephen Last asked:

I have nginx 1.10.1 running on Windows Server 2012 R2, and I have just bought and installed an SSL cert from GoDaddy.

I have changed my config to what I think it should be, but it’s not working. The website is still working over http, but I get a timeout over https. I’m hoping it’s something really simple that I’m missing. This is the first time I’ve tried to install an SSL cert with 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/;
    }
}

I can’t see any issues in the logs.

Websites:

Visiting https://www.thepreventduty.co.uk/ from the server itself works.

Why is the https version not working externally..?

My answer:


You have port 443 firewalled. Open this port.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.