R
R
raiboon2015-02-06 17:52:11
Nginx
raiboon, 2015-02-06 17:52:11

How to set up nginx redirects?

Already worn out, but I can not configure the correct behavior.
Help set up 301 redirects with

http://www.site.com, http://site.com, https://www.site.com на https://site.com

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Fateev, 2015-02-06
@svfat

server {
    listen 80;
    server_name www.site.com site.com;
    return 301 https://site.com$request_uri;
}

server {
    listen 443 ssl;
    server_name www.site.com;
    return 301 https://site.com$request_uri;
}

server {
    listen 443 ssl;
    server_name site.com;
    # основная часть
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question