一、HTTP
server {
location / {
alias /home/project/page/;
index index.html index.htm;
try_files $uri $uri/ / index.html;
}
location /test/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8090;
}
}
二、HTTPS
server {
location / {
alias /home/project/page/;
index index.html index.htm;
try_files $uri $uri/ / index.html;
}
location /admin-server/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Content-Security-Policy "upgrade-insecure-requests";
proxy_redirect http:// $scheme://;
proxy_pass http://localhost:8090;
}
}