server {
listen? ? ? 80;
?server_name? ABC.com;
charset utf-8;
#access_log? logs/host.access.log? main;
location / {
try_files $uri $uri/ /index.html;#支持history模式刷新兜畸,解決前端history模式下红伦,出現(xiàn)404
root? /home/WebServer/dist;
index? index.html index.htm;
}
location ^~ /apis/{#表示匹配apis
proxy_pass http://11.1.1.144:8080/;#后臺(tái)服務(wù)恍箭,此處URL需要追加 “/” 轉(zhuǎn)發(fā)請(qǐng)求到后臺(tái)會(huì)去掉apis否則會(huì)保留apis
proxy_cookie_path / /;
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_set_header X-Forwarded-For $remote_addr;
#? proxy_cache_methods POST;
}
access_log /data/logs/nginx/ABC.com/access.log access;
error_log? /data/logs/nginx/ABC.com/error.log error;
}