# 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
搜索
复制