vue打包后,nginx运行代理不上
nginx 配置文件,加上配置代理(部分配置):
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
# 解决刷新页面 404
try_files $uri $uri/ /index.html
index index.html index.htm;
}
# 参考以下代理
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:8080/;
}