Question
Insecure Connection with www for nginx
if i go to mydomain.com
it will redirect to https://mydomain.com
, the same is trye for any other http
connection. However, if i type.
https://www.mydomain.com/
i will get a browser warning of Your connection is not secure
mydomain.com
server {
listen 80;
listen [::]:80;
server_name mydomain.com www.mydomain.com *.mydomain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/ssl-mydomain.com.conf;
include snippets/ssl-params.conf;
root /var/www/mydomain.com/html;
index index.html index.htm index.nginx-debian.html;
server_name mydomain.com;
location ~ /.well-known {
allow all;
}
location / {
try_files $uri $uri/ =404;
}
}
I’ve tried adding the listen 443 to the first server
tag but that didn’t resolve anything. Any help is appreciated :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×