server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}
location /.well-known {
root /home/ubuntu/again/222/static;
}
}
server {
listen 80;
listen [::]:80;
server_name old.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}
}
server {
listen 80;
server_name api.domain.ru www.api.domain.ru;
proxy_set_header Host api.domain.ru;
location / {
rewrite ^(.*)$ https://api.domain.ru$1 permanent;
}
return 301 https://api.domain.ru$request_uri;
}
server {
listen 443 ssl http2;
server_name api.domain.ru www.api.domain.ru;
#......................
}
#################################################################
server {
listen 80;
server_name domain.ru www.domain.ru;
proxy_set_header Host domain.ru;
location / {
rewrite ^(.*)$ https://domain.ru$1 permanent;
}
return 301 https://domain.ru$request_uri;
}
server {
listen 443 ssl http2;
server_name domain.ru www.domain.ru;
#.......................
}
server_name old.example.com;
в последний конфиг.listen 443 ssl http2;
server_name old.example.com;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;