# HTTPS server server { listen 443; server_name ************.com; ssl on; ssl_certificate cert/************.com.pem; ssl_certificate_key cert/******** ...
# HTTPS server
server {
listen 443;
server_name ************.com;
ssl on;
ssl_certificate cert/************.com.pem;
ssl_certificate_key cert/************.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
location / {
root /usr/local/web/AAAA;
index index.html index.htm;
}
root /usr/local/web;
location /BBBBB{
index index.html index.htm;
}
####重點###當在BBBB項目里後端代理路徑就是以BBBB開頭了,只配置/api
代理路徑請求後端會報404,需要在配置/BBBBB/api的代理
location /BBBBB/api {#這裡是核心,與開發環境中代理路徑一定要保持一致
proxy_set_header Host $host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://************:8080/api;#後臺的介面
}
####後端代理路徑地址 ‘/api開頭的都走這個代理’
location /api {#這裡是核心,與開發環境中代理路徑一定要保持一致
proxy_set_header Host $host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://************:8080;#後臺的介面
}
}
————————————————
版權聲明:本文為CSDN博主「一程式一世界」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/Hello_word_2/article/details/128057295
搜索
複製