访问地址 http://二级域名称.域名名称.com/
server {
listen 80;
server_name 二级域名称.一级域名xxxxx.com;
location / {
proxy_pass http://localhost:8282;
}
}
server{
listen 8282;
server_name localhost;
location / {
root /home/ncyh_lkjp/web/dist; //前端部署地址
try_files $uri $uri/ /index.html;
index index.html index.html;
}
location /prod-api/ { // 后端服务接口前缀
proxy_set_header Host $http_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:9080/; // 后端服务器端口号
}
}
标签:index,set,http,配置,header,二级域名,nginx,proxy From: https://www.cnblogs.com/zhaoxiaobei/p/18059403