Reputation: 277
I set up a secure connection for my site, but nginx does not redirect https to my instance. When I go to the url https:mydomain.com the nginx shows me Welcome to nginx page.
My nginx config
server {
listen 80;
# The host name to respond to
server_name mydomain.com www.mydomain.com;
location / {
# Backend server
proxy_pass http://000.000.00.000:8080;
}
}
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
server {
listen 443;
server_name mydomain.com www.mydomain.com;
ssl on;
ssl_certificate /root/ssl/mydomain.com/mycert.crt;
ssl_certificate_key /root/ssl/mydomain.com/private.key;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!MD5;
charset utf-8;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://000.000.00.000:8080;
proxy_read_timeout 90;
}
}
Upvotes: 4
Views: 11805
Reputation: 7130
If your server is in a docker container, maybe you forget to map the port 443 to 443.
-p 443:443
Upvotes: 5
Reputation: 143
Assuming you have no typo in your actual domain name, the configuration looks OK. I would try and test if this piece of configuration is applied at all:
default_server
at the end of the listen directive.If you then see a 404, then the part of the config you posted is not loaded at all, maybe you put it in sites-available and forgot to symlink to sites-enabled. Also make sure there is no default_server
in the config of the nginx welcome page.
Upvotes: 1