Добавление каталога к домену
server {
server_name element1.nbics.net;
keepalive_timeout 60;
location / {
proxy_pass http://localhost:7875; # Порт первого приложения
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache off;
proxy_buffering off;
proxy_read_timeout 100s;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Добаление секции для подкаталога instance2
# Не забываем ставить слэш в конце location /instance2/
location /instance2/ {
proxy_pass http://localhost:7041; # Порт второго приложения
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache off;
proxy_buffering off;
proxy_read_timeout 100s;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Удаляем префикс /instance2 для контейнера
rewrite ^/instance2/(.*)$ /$1 break;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/element1.nbics.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/element1.nbics.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = element1.nbics.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name element1.nbics.net;
return 404; # managed by Certbot
}
No Comments