nginx443端口转发其他端口
时间: 2023-10-13 18:06:52 浏览: 199
可以使用Nginx配置文件中的反向代理来实现将443端口的请求转发到其他端口。
在Nginx的配置文件中,可以使用以下配置来实现443端口转发到9509端口的功能:
```
server {
listen 443;
ssl on;
server_name www.test.com;
client_max_body_size 120m;
location /wss {
proxy_pass http://127.0.0.1:9509;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
```
上述配置中,`server`块定义了监听443端口和配置SSL的相关设置。`location /wss`指定了请求路径为/wss时的转发规则。`proxy_pass`指定了转发的目标地址为http://127.0.0.1:9509,即将443端口的请求转发到9509端口。
通过以上配置,当有请求访问https://www.test.com/wss时,Nginx会将请求转发到http://127.0.0.1:9509进行处理。这样就实现了将443端口的请求转发到其他端口的功能。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [socket通过nginx监听443端口,跳转到其它相关端口处理方式:](https://blog.csdn.net/weixin_41380972/article/details/79806565)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Linux服务环境搭建相关软件(JDK、Nginx、Tomact)](https://download.csdn.net/download/qi_ming88/88240548)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文