简体   繁体   English

如何在CentOS上的Apache 2.2上设置mod_proxy_wstunnel

[英]How to set up mod_proxy_wstunnel on Apache 2.2 on CentOS

is there a way to set up the "mod_proxy_wstunnel" module on Apache 2.2 on CentOS? 有没有办法在CentOS上的Apache 2.2上设置“mod_proxy_wstunnel”模块? I can't upgrade to 2.4 due to project limitations. 由于项目限制,我无法升级到2.4。

I have invested lot of time figuring this out and there is very little documentation available for this. 我已投入大量时间来解决这个问题,而且很少有文档可供使用。 Let me know if this helps, else I can help you troubleshooting the problem. 如果这有帮助,请告诉我,否则我可以帮助您解决问题。 Also hope this helps to future readers. 也希望这有助于未来的读者。

To compile mod_proxy_wstunnel.so, 编译mod_proxy_wstunnel.so,

1) yum install httpd-devel 1)yum install httpd-devel
2) Download the mod_proxy_wstunnel.c 2)下载mod_proxy_wstunnel.c
3) Compile it using, apxs -i -a -c mod_proxy_wstunnel.c 3)使用,apxs -i -a -c mod_proxy_wstunnel.c编译它

Now load the above compiled module in /etc/httpd/modules 现在在/ etc / httpd / modules中加载上面编译的模块

1) Copy the mod_proxy_wstunnel.so in /etc/httpd/modules (Compiled from above) 1)复制/ etc / httpd / modules中的mod_proxy_wstunnel.so(从上面编译)

2) In order to load the module while the server starts, use LoadModule directive in the httpd conf file, /etc/httpd/conf/httpd.conf 2)为了在服务器启动时加载模块,请在httpd conf文件/etc/httpd/conf/httpd.conf中使用LoadModule指令

Add the following line with all other LoadModule line, 将以下行添加到所有其他LoadModule行,

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so LoadModule proxy_wstunnel_module modules / mod_proxy_wstunnel.so

3) To restart apache , use service httpd restart 3)要重新启动apache,请使用service httpd restart

4) To check the loaded modules in apache after restarting use, httpd -M 4)重启后使用httpd -M检查apache中加载的模块

5) After the module is installed, Add this two lines in /etc/httpd/conf/httpd.conf 5)安装模块后,在/etc/httpd/conf/httpd.conf中添加这两行

ProxyPass /websockets/mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry=4 ProxyPass / websockets / mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry = 4
ProxyPassReverse /websockets/mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry=4 ProxyPassReverse / websockets / mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry = 4

Note : Make sure the above lines are added before the default case of /. 注意:确保在/的默认情况之前添加上面的行。 Also restart apache just to be safe. 同时重启apache只是为了安全起见。

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

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