Answer the question
In order to leave comments, you need to log in
How to properly redirect nginx from http to https?
At some point after upgrading nginx to nginx/1.10.3, the old constructs stopped working. The server gives a 400 error.
Now even the simplest constructions:
server {
listen 80;
server_name example.com;
proxy_set_header Host example.com:443; #С этой строчкий или без неё. С портом или без порта.
return 301 https://$host$request_uri; #C такой конструкцией
#location / {rewrite ^(.*)$ https://example.com$1 permanent;} #Или с такой
}
2019/01/21 15:24:46 [info] 16330#16330: *1061 client sent plain HTTP request to HTTPS port while reading client request headers, client: [ip], server: example.com, request: "GET / HTTP/1.1", host: "example.com"
server {}
also does not work. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question