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

相关推荐
痕迹运维1 天前
Nginx SFTP代理
nginx
BreezeJiang1 天前
为什么生成了 dist,项目还是可能跑不起来?从一个 React + Express + MySQL 项目看部署闭环
nginx·react.js
Darling噜啦啦1 天前
前端到上线全流程:从买服务器到 Nginx 反向代理,搞懂全栈部署
nginx·全栈
烬羽1 天前
我把"时间胶囊"部署上腾讯云宝塔,跨域从根源消失了
nginx·node.js·全栈
En^_^Joy2 天前
Nginx 从入门到精通:配置、原理与实战详解
运维·nginx
2601_962128263 天前
Nginx目录结构
运维·nginx
2601_962122973 天前
nginx 部署前端vue项目
前端·vue.js·nginx
2601_962128263 天前
Nginx知识详解(理论+实战更易懂)
运维·nginx
2601_962203513 天前
Nginx 安装配置
运维·nginx
牧码岛4 天前
阿里云服务器新端口上线SOP(Windows+Nginx+HTTPS)
服务器·nginx·阿里云