VUE 项目 nginx部署

复制代码
server {
       listen       80;  # 监听的端口号
       server_name  129.204.189.149;  # 服务器的ip或者域名

       #charset koi8-r;

       #access_log  logs/host.access.log  main;
	
	  # 前端服务反向代理配置
       location / {
           proxy_http_version 1.1;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           root /root/baker/vue-recruit/dist;  # dist目录在服务器的完整路径
           index index.html index.htm;
       }
       
      # 后端服务反向代理配置
       location /api {
           proxy_http_version 1.1;
           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://129.204.189.149:5000/;  # 后端服务所部署的服务器地址以及端口号
       }
}

Nginx反向代理部署前端Vue项目_can_chen的博客-CSDN博客

相关推荐
w***741721 小时前
Nginx—Rewrite
java·数据库·nginx
k***19521 小时前
Nginx反向代理出现502 Bad Gateway问题的解决方案
运维·nginx·gateway
可爱又迷人的反派角色“yang”21 小时前
LVS+Keepalived群集
linux·运维·服务器·前端·nginx·lvs
4***v2141 天前
使用 Certbot 为 Nginx 自动配置 SSL 证书
运维·nginx·ssl
e***71671 天前
Linux下安装Nginx服务及systemctl方式管理nginx详情
linux·运维·nginx
5***g2291 天前
Ubuntu 系统下安装 Nginx
数据库·nginx·ubuntu
g***72701 天前
Nginx 缓存清理
运维·nginx·缓存
q***48411 天前
Nginx中$http_host、$host、$proxy_host的区别
运维·nginx·http
k***12171 天前
【Nginx 】Nginx 部署前端 vue 项目
前端·vue.js·nginx
2301_804947581 天前
nginx的https的搭建
运维·nginx·https