[Nginx] nginx配置域名反代后端端口
2023-02-18 15:41:09 时间
下载GOFLY客服(go语言开发的在线客服系统)系统后 ,运行起来服务 ,默认是监听8081端口
这个时候,只能使用http://ip:8081这样的形式来访问 ,不符合实际需求
下载安装配置nginx后,就可以通过域名来访问服务了
ubuntu系统安装nginx
apt-get install curl gnupg2 ca-certificates lsb-release echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | tee /etc/apt/sources.list.d/nginx.list curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - apt-key fingerprint ABF5BD827BD9BF62 apt-get update apt-get install nginx
centos系统安装nginx
vim 编辑 /etc/yum.repos.d/nginx.repo
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
yum install nginx
配置nginx反向代理
location /static { } 这里配置的是,访问静态资源的时候,直接nginx返回静态资源,就不用走到go后端服务了
proxy_pass http://127.0.0.1:8081; 这里就是重点了,反向代理到后端8081端口
下面这几句是传递真实IP到后端服务
proxy_set_header X-Real-IP $remote_addr;
升级连接成为websocket连接 , 支持websocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Origin "";
server{ listen 80; server_name gofly.sopans.com; access_log /var/log/nginx/gofly.sopans.com.access.log main; location /static { root /var/www/html/go-fly;//自己的部署路径,静态文件直接nginx响应 } location / { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin ""; } }
在线客服系统的访问网址:https://gofly.sopans.com/
相关文章
- 论文解读(CDCL)《Cross-domain Contrastive Learning for Unsupervised Domain Adaptation》
- 用户触达难?流失率高?HMS Core预测服务和智能运营,助你提前掌握营销时机,解决此难题。
- 谣言检测(SRD-PSCD)《Rumor Detection with Self-supervised Learning on Texts and Social Graph》
- HMS Core 分析服务 6.4.1版本上线啦,快来看看更新了哪些内容。
- 论文解读(RDGCN)《Region-enhanced Deep Graph Convolutional Networks for Rumor Detection》
- HMS Core定位服务在生活服务类App中可以自动填写收货地址啦
- 谣言检测(RDCL)——《Towards Robust False Information Detection on Social Networks with Contrastive Learning》
- HMS Core 机器学习服务6.4.0版本更新啦,文本翻译功能增加10种小语种语言类型!
- 论文解读(FedPCL)《Federated Learning from Pre-Trained Models: A Contrastive Learning Approach》
- NIPS2022上的图神经网络相关论文总结
- 拿捏了!这样的购物体验才深得用户心
- HMS Core机器学习服务图像超分能力,基于深度学习提升新闻阅读体验
- 论文解读(GGD)《Rethinking and Scaling Up Graph Contrastive Learning: An Extremely Efficient Approach with Group Discrimination》
- HMS Core视频编辑服务:AI着色, 忆往昔看今朝
- 谣言检测(DUCK)《DUCK: Rumour Detection on Social Media by Modelling User and Comment Propagation Networks》
- 谣言检测(RDEA)《Rumor Detection on Social Media with Event Augmentations》
- 谣言检测()《Data Fusion Oriented Graph Convolution Network Model for Rumor Detection》
- 【FAQ】关于分析服务错误获取所选日期前一天事件数据的解决方法
- 谣言检测(ClaHi-GAT)《Rumor Detection on Twitter with Claim-Guided Hierarchical Graph Attention Networks》
- 华为音频编辑服务,实时分离人声、伴奏和乐器声