一、需求说明
基于Nginx代理nginx.conf配置——反向代理,如果要添加websocket支持,需要进行如下配置
二、配置内容
在http中添加一下配置,添加对websocket支持
http {
# 配置其它内容
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# 配置其它server
server {
listen 9016;
server_name localhost;
location /ws {
proxy_pass http://xxx.xxx.xxx.xxx:9016/ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
三、配置结果
配置后重新运行nginx后,websocket即可成功代理。注意防火墙端口是否开放、nginx如果使用docker,其对应的端口是否映射出来。











![[工业互联-14]:机器人操作系统与ROS](https://img-blog.csdnimg.cn/6075dbd7249e4ee88541cf1ef5e25fce.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5oiR5LiObmFubw==,size_20,color_FFFFFF,t_70,g_se,x_16)





![[mj_robot_sim]多关节机器人仿真软件介绍](https://img-blog.csdnimg.cn/19e0ff0b27e6415b8f679ef6910a0d2d.png)

