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博客

相关推荐
Arya_aa21 小时前
四:部署前端和后端
nginx
Java面试题总结1 天前
一文搞定 Linux Nginx 从安装、启动到 nginx.conf 全配置详解(新手也能看懂)
linux·运维·nginx
MiNG MENS2 天前
nginx 代理 redis
运维·redis·nginx
珊瑚怪人2 天前
一个域名问题
nginx
dxdz2 天前
一文搞定 Linux Nginx 从安装、启动到 nginx.conf 全配置详解(新手也能看懂)
nginx
遇见火星2 天前
Nginx 负载均衡配置模板:轮询、权重、IP哈希、最少连接
tcp/ip·nginx·负载均衡
untE EADO2 天前
Nginx代理到https地址忽略证书验证配置
运维·nginx·https
Treh UNFO2 天前
nginx的重定向
大数据·数据库·nginx
理人综艺好会2 天前
nginx了解
运维·nginx
likeGhee2 天前
docker创建nginx+keepalived+nacos集群(仅测试环境)
nginx·docker