N
N
nautilus6442020-04-29 19:14:15
URL Handling
nautilus644, 2020-04-29 19:14:15

Ngnix from https://www.site.ru to https://site.ru, correct option?

Hello!
Guys tell me how to redirect https://www.site.ru to https://site.ru ?
Already tried a bunch of options, here is one of them:
server {
listen 80;
server_name www.example.com
return 301 https://example.com$request_uri;
}

server {
listen *:80;
server_name example.com;
proxy_set_header Host example.com;
location / {
rewrite ^(.*)$ https://example.com$1 permanent;
}
}
server {
listen *:443 ssl;
server_name example.com;
proxy_set_header Host example.com;
location / {
proxy_pass http://127.0.0.1:8080;
}
}

And all the same does not work.
Each time I restart the ngnix service from the ISP panel.
This is already configured for the site by someone, the following redirection:
site.ru to https://site.ru
www.site.ru to https://site.ru

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question