A
A
ArrayPop2019-11-28 23:07:44
Nginx
ArrayPop, 2019-11-28 23:07:44

Why when there is a redirect in nginx from http to https, then the ssl certificate cannot be updated?

I don’t understand what’s wrong in the code, I set it up just like here https://oxozle.com/2018/01/21/nastrojka-ssl-let-s-...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
latush, 2019-11-29
@latush

include /etc/nginx/snippets/letsencrypt.conf;
in
server {
listen 443 ssl http2;
...
}
add

A
ArrayPop, 2019-11-29
@ArrayPop

Answer found! Sometimes they write this construction in articles on installing a certificate on nginx:
server {
listen 80;
listen[::]:80 ipv6only=on;
server_name oxozle.com;
include /etc/nginx/snippets/letsencrypt.conf;
return 301 https://$host$request_uri;
}
in this case, the certificate will not be updated, due to the instant redirect,
so you need to specify the location of the redirect "/", and not when initializing the server.
server {
listen 80;
listen[::]:80 ipv6only=on;
server_name oxozle.com;
include /etc/nginx/snippets/letsencrypt.conf;
location /{
return 301 https://$host$request_uri;
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question