Answer the question
In order to leave comments, you need to log in
Redirect to https without www?
Hello.
It is necessary that the domain works only in the form https://domain.ru .
domain.ru --> https://domain.ru
www.domain.ru --> https://domain.ru
http://domain.ru --> https://domain.ru
http://www.domain.ru --> https://domain.ru
https://www.domain.ru --> https://domain.ru
server {
listen ип:80;
server_name domain.ru www.domain.ru;
return 301 https://domain.ru$request_uri;
}
server {
listen ип:443 ssl;
server_name domain.ru;
...
Answer the question
In order to leave comments, you need to log in
start another server on port 443 with server_name www.domain.ru and redirect it to https://domain.ru
I use this option on VestaCP.
I think it will not be difficult to substitute your own values.
#default.tpl
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
return 301 https://%domain_idn%$request_uri;
}
#default.stpl
server {
listen %ip%:%web_ssl_port% http2 ssl;
server_name %alias_idn%;
return 301 https://%domain_idn%$request_uri;
#Не знаю, должно ли быть это или нет в этом server:
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
}
server {
listen %ip%:%web_ssl_port% http2 ssl;
server_name %domain_idn%;
root %sdocroot%;
index index.php index.html index.htm;
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
location / {
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question