当前位置: 首页 > news >正文

vue部署宝塔nginx配置(获取用户ip地址、反代理访问api接口、websocket转发)

 以下配置为我自己的需求,因人而异,如果只是单纯的前端非交互页面,可以不用修改配置。

 代码及注释,如下:

    #解决vue-router设置mode为history,去掉路由地址上的/#/后nginx显示404的问题location / {proxy_http_version 1.1;try_files $uri $uri/ /index.html;}#获取用户真实ip地址proxy_set_header Host $proxy_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;#反向代理访问api接口location /api{proxy_http_version 1.1;rewrite ^.?api/?(.*)$ /$1 break; include uwsgi_params;proxy_pass http://XXX.XXX.XXX.XXX:8888;} #https下使用wss的websocket转发location /chat{proxy_pass http://175.XXX.XXX.XXX:8082;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";proxy_set_header X-real-ip $remote_addr;proxy_set_header X-Forwarded-For $remote_addr;}

http://www.lryc.cn/news/376094.html

相关文章:

  • Jenkins教程-3-github自动化测试任务构建
  • 0元体验苹果macOS系统,最简单的虚拟机部署macOS教程
  • Codeforces Round 946 (Div. 3) E. Money Buys Happiness
  • Git记录 上传至Gitee
  • 笔记-前端
  • 事务AOP
  • RAM和ROM
  • 聊聊系统架构之负载均衡优化实践
  • 代码规范性思考
  • TestProject Python SDK入门
  • 服务器数据恢复—EMC Isilon存储中被误删的虚拟机数据恢复案例
  • 华为安全Security认证,你了解多少?
  • 自动驾驶规划-RTT* 算法 【免费获取Matlab代码】
  • shell编程中的运算符的讲解
  • yudao-ui-admin-vue3 nginx配置
  • vue3第四十节(pinia的用法注意事项解构store)
  • PostgreSQL源码分析——索引扫描
  • 零基础入门学用Arduino 第四部分(一)
  • x-anylabelimg如何标识人脸
  • Element-ui中Table表格无法显示
  • 电信网关配置管理系统 del_file.php 前台RCE漏洞复现
  • 游戏心理学Day18
  • 发文章不违规的5种解决方案,非常适用,记得收藏!
  • 【ARMv8/ARMv9 硬件加速系列 2.2 -- ARM NEON 的加减乘除(左移右移)运算】
  • [2024-06]-[大模型]-[Ollama]- WebUI
  • AI智能盒子助力中钢天源设备工厂升级安全防护
  • RNN的变种们:GRULSTM双向RNN
  • Linux网络-HttpServer的实现
  • GPT-4o的综合评估与前景展望
  • 私人云盘(自动云同步)