Answer the question
In order to leave comments, you need to log in
Is this the correct nginx redirect?
I set up a redirect to the main domain, otherwise Google and Yandex were grabbing https://www.site.ru
server {
listen 80;
listen 443 ssl;
server_name www.site.ru; # здесь нет без "www"
ssl_certificate /etc/letsencrypt/live/site.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/site.ru/privkey.pem;
return 301 https://site.ru$request_uri;
}
server {
listen 80;
server_name site.ru;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name site.ru; # а здесь нет с "www"
ssl_certificate /etc/letsencrypt/live/site.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/site.ru/privkey.pem;
Answer the question
In order to leave comments, you need to log in
Yes, everything seems to be fine, just add www.site.ru here
listen 80;
server_name site.ru;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question