apache websockets reverse proxy
如何让Apache反向代理Web套接字连接?
我有一个聊天室应用程序,可以在本地主机上正常工作,但不适用于通过反向代理进行的连接。
我如何设置它使其起作用?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <VirtualHost *:80> ServerAdmin [email protected] ProxyRequests off DocumentRoot /var/www ProxyPreserveHost On ServerName 82.2.180.6 ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined LogLevel error <Location /> ProxyPass http://127.0.0.1:3050/ ProxyPassReverse http://127.0.0.1:3050/ Order allow,deny Allow from all </Location> </VirtualHost> |
是的,有可能。我们已经使用Apache来反向代理websocket。
确保您的Apache是??使用以下模块构建的:mod_proxy_wstunnel。在2.4.5版之后受支持。
然后,您只需要找出Websocket使用哪个端口即可。
如果它也使用3050,则需要这样的内容:
1 2 3 4 5 6 7 8 | LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #***SKIPPED OTHER HTTPD CONFIG*** <Location /> ProxyPass ws://127.0.0.1:3050/ ProxyPassReverse ws://127.0.0.1:3050/ </Location> |