Solved!
<!--LiveInternet counter--><script type="text/javascript">jQuery(function($){$('.footer').append("<a href='//www.liveinternet.ru/click' target=_blank><img src='//counter.yadro.ru/hit?t14.1;r" + escape(document.referrer) + ((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + ";u" + escape(document.URL) +";h"+escape(document.title.substring(0,80)) + ";" + Math.random() + "' border=0 width=88 height=31 alt='' title='LiveInternet: показано число просмотров за 24 часа, посетителей за 24 часа и за сегодня'><\/a>")});</script><!--/LiveInternet-->SOLVED redirection problem with ssl
-
hello,
my site redirect ;
to https://mydomain.com GOOD
to https://mydomain.com GOODbut DO NOT redirect
to https://mydomain.com NOT GOOD
it stays as https://www.mydomain.com
my default /etc/nginx/sites-enabled/default is ;
listen 80; server_name mydomain.com www.mydomain.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name mydomain.com www.mydomain.com; ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://1.1.1.1.1.1.1.3:4567/; proxy_redirect off; #Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~ /.well-known { allow all; } } any idea pleaase. thank you in advance.
-
@atozsoft said in redirection problem with ssl:
hello,
my site redirect ;
to https://mydomain.com GOOD
to https://mydomain.com GOODbut DO NOT redirect
to https://mydomain.com NOT GOOD
it stays as https://www.mydomain.com
my default /etc/nginx/sites-enabled/default is ;
listen 80; server_name mydomain.com www.mydomain.com; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name mydomain.com www.mydomain.com; ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://1.1.1.1.1.1.1.3:4567/; proxy_redirect off; #Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~ /.well-known { allow all; } } any idea pleaase. thank you in advance.
Make a second Block for 443 that does a redirect like port 80 except specifically redirect it to https://domain.com$request_uri Instead of https://$host$request_uri
Only put in the www.domain.com server.
Take the www.domain.com out of the existing 443 block.
I assume (never tested this) that the new 443 block will need the SSL settings.
-
thank you @JaredBusch
i tried but got error. site did not load.
-
Fixed by adding
if ($host = www.$server_name) {
rewrite ^(.*) https://$server_name$request_uri? permanent;
}after
proxy_set_header Connection "upgrade";
}line.