...
server {
listen 80;
listen 443 ssl;
if ($scheme = 'http') {
return 301 https://$host$request_uri;
}
server_name _;
root /var/www/ui2;
index index.html;
client_max_body_size 500M;
ssl_certificate /etc/nginx/certs/wnam2.crt;
ssl_certificate_key /etc/nginx/certs/wnam2.key;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html =404;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
}location /docs/ {
try_files $uri $uri/ =404;
root /var/www;
index index.html;
}location /api/2.0/ {
proxy_pass http://127.0.0.1:8080/api/2.0/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 900;
proxy_connect_timeout 120;
proxy_buffering off;
proxy_intercept_errors on;error_page 502 503 504 /api/proxy_error.html;
Тоесть обявление То есть объявление location сделаны в основом конфигеосновной конфигурации. Теперь требуется удалить все объявления location и добавить строку include /etc/nginx/wnam2-site-locations/*.conf;
В результате конфиг конфигурация приобретет приблизительно такой вид:
server {
listen 80;
listen 443 ssl;
if ($scheme = 'http') {
return 301 https://$host$request_uri;
}
server_name _;
root /var/www/ui2;
index index.html;
client_max_body_size 500M;
ssl_certificate /etc/nginx/certs/wnam2.crt;
ssl_certificate_key /etc/nginx/certs/wnam2.key;
include /etc/nginx/wnam2-site-locations/*.conf;}
После этого трубется требуется перезапустить сервис nginx
...