简体   繁体   中英

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? I can't upgrade to 2.4 due to project limitations.

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,

1) yum install httpd-devel
2) Download the mod_proxy_wstunnel.c
3) Compile it using, apxs -i -a -c mod_proxy_wstunnel.c

Now load the above compiled module in /etc/httpd/modules

1) Copy the mod_proxy_wstunnel.so in /etc/httpd/modules (Compiled from above)

2) In order to load the module while the server starts, use LoadModule directive in the httpd conf file, /etc/httpd/conf/httpd.conf

Add the following line with all other LoadModule line,

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

3) To restart apache , use service httpd restart

4) To check the loaded modules in apache after restarting use, httpd -M

5) After the module is installed, Add this two lines in /etc/httpd/conf/httpd.conf

ProxyPass /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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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