server {
listen 8080;
server_name localhost;
location / {
root E:/proj/mis-ui/dist/;
index index.html;
try_files $uri $uri/ /index.html;
}
# if ($request_method = "OPTIONS") {
# return 204;
# }
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://abc.com/;
}
}
nginx部署vue打包后的项目
配置Nginx反向代理与服务器设置
最新推荐文章于 2024-08-10 22:01:37 发布
这篇博客详细介绍了如何配置Nginx服务器,包括监听8080端口,设置默认主页为E:/proj/mis-ui/dist/index.html,并实现URL重写。此外,还特别关注了对/prod-api/路径的处理,通过反向代理将请求转发到http://abc.com/,确保了API请求的正确路由。
1721

被折叠的 条评论
为什么被折叠?



