简体   繁体   English

是否可以在一个安全端口上全部运行webserver和socket.io?

[英]Is it possible to run a webserver and socket.io all on one secure port?

I have an Apache webserver serving pages on port 443 and socket.io responding on port 8888. 我有一个Apache网络服务器在端口443上提供页面,而socket.io在端口8888上进行响应。

Is there any way to have just the secure port (443) handle everything (ie webpages and socket.io) and close everything else? 有什么方法可以让安全端口(443)处理所有内容(即网页和socket.io)并关闭其他所有内容吗?

Many of my customers will only have ports 80 and 443 available to them. 我的许多客户只能使用80和443端口。 I don't want to send insecure data over port 80. 我不想通过端口80发送不安全的数据。

You could use apache to listen on 443 and "reverse" proxy requests to socket.io on port 8888 based on an url. 您可以使用apache侦听443,并基于URL在端口8888上“反向”代理请求到socket.io。

Similar questions were already asked here: Apache, NodeJS and socket.io: Use Apache or NodeJS as Reverse-Proxy? 这里已经问过类似的问题: Apache,NodeJS和socket.io:使用Apache还是NodeJS作为反向代理? , http://www.apachetutor.org/admin/reverseproxies and http://www.microhowto.info/howto/configure_apache_as_a_reverse_proxy.html http://www.apachetutor.org/admin/reverseproxieshttp://www.microhowto.info/howto/configure_apache_as_a_reverse_proxy.html

Official apache documentation is here: https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassreverse 官方的Apache文档在这里: https : //httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypassreverse

看起来mod_proxy_wstunnel可能会满足您的要求:

ProxyPass /wss2/ ws://localhost:8888/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM