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

相关推荐
cnskylee5 小时前
【Nginx】Nginx-1.28.1版本已恢复对CentOS 7的兼容性
运维·nginx·centos
Knight_AL1 天前
Docker 中的端口映射原理:为什么 Nginx 要 `listen 80`,而不是“随便写端口”
nginx·docker·容器
虹梦未来1 天前
【运维心得】Ubuntu2404编译nginx隐藏Server信息
运维·服务器·nginx
tgethe1 天前
Nginx笔记
运维·笔记·nginx
invicinble1 天前
对于nginx(一,认识nginx)
运维·nginx
徒手千行代码无bug1 天前
Nginx upstream 负载均衡 404,单节点转发正常的根因与解决
运维·nginx·负载均衡
irisart1 天前
第二章【NGINX 开源功能】—— 七层反向代理(下)
运维·nginx
xixiyuguang1 天前
nginx tar离线安装 ubuntu22.04
运维·nginx
丁丁丁梦涛1 天前
nginx解决域名代理到IP+端口的平台静态资源和接口地址问题
运维·tcp/ip·nginx
苹果醋31 天前
24.记录Vue项目iview组件日期获取时间少一天
java·运维·spring boot·mysql·nginx