Answer the question
In order to leave comments, you need to log in
Redirecting to https://www.domain.com in nginx?
Good afternoon!
Tell me how to redirect to https://www.domain.com?
Redirecting to https is done like this:
server {
listen *:80;
server_name www.domain.com domain.com;
location / {
rewrite ^(.*)$ https://www.domain.com$1 permanent;
}
}
Answer the question
In order to leave comments, you need to log in
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://www.domain.com$request_uri ;
}
server {
listen 443 ssl;
server_name domain.com;
return 301 https://www.domain.com$request_uri ;
}
server {
listen 443 ssl;
server_name www.domain.com domain.com;
# основная секция
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question