路徑轉(zhuǎn)發(fā)
我的主域名是test.my,我想將test.my/service/*的請(qǐng)求轉(zhuǎn)發(fā)給8080端口的服務(wù)處理。
server {
listen 80;
server_name test.my;
access_log /log/test_access.log;
error_log /log/test_error.log;
root /;
location / {
root /home/centos/test/;
index index.html;
}
location ^~ /service/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8081/;
}
}
子路徑靜態(tài)頁面
我想將靜態(tài)vue項(xiàng)目生成的靜態(tài)頁面掛載到page.my/docs路徑,需要為項(xiàng)目路徑引用添加前綴/docs/,否則將引用錯(cuò)誤。