Answer the question
In order to leave comments, you need to log in
How to set up the nginx config if there is one https and several http sites on the server?
The server has one site with https. This is the config for it:
server {
listen 443;
server_name domen.ru;
...
server {
listen 80;
server_name www.domen.ru domen.ru;
return 301 https://domen.ru$request_uri;
}
server {
listen 443;
server_name www.domen.ru;
return 301 https://domen.ru$request_uri;
}
Answer the question
In order to leave comments, you need to log in
Since you have only one https site, it is the default one, i.e. processes requests to undescribed sites received by the server. Therefore, in the config of this site, make a redirect for https requests to "left" names to http.
Issue a certificate for each domain of http sites (otherwise browsers will swear) and register the https configuration for each of these sites in nginx. If you want a redirect - a separate server block, if you just want to get these sites via https - add listen 443 ssl and keys to the old server block.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question