Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
litespeed_wiki:proxy:lsws-as-a-websocket-proxy [2019/06/11 19:26] Jackson Zhang |
litespeed_wiki:proxy:lsws-as-a-websocket-proxy [2020/01/09 00:36] (current) Lisa Clarke [How to Configure LSWS in cPanel as a WebSocket Proxy] Proofreading |
||
---|---|---|---|
Line 31: | Line 31: | ||
Save and restart LSWS. | Save and restart LSWS. | ||
+ | |||
+ | ===== How to Configure LSWS in cPanel as a WebSocket Proxy ===== | ||
+ | |||
+ | LSWS supports ''ProxyPass'' for WebSocket, used like so: | ||
+ | |||
+ | <code>ProxyPass / ws://localhost:3000/</code> | ||
+ | |||
+ | **Note**: This directive must be placed in an Apache vhost configuration file, not in .htaccess. | ||
+ | |||
+ | For example, for RocketChat, create two files like these, replacing ''EXAMPLE'' and ''www.example.com'' with the cPanel username and the actual domain: | ||
+ | |||
+ | ''/etc/apache2/conf.d/userdata/ssl/2_4/EXAMPLE/www.example.com/proxy.conf'' | ||
+ | |||
+ | ''/etc/apache2/conf.d/userdata/std/2_4/EXAMPLE/www.example.com/proxy.conf'' | ||
+ | |||
+ | Add the following code to both files: | ||
+ | |||
+ | <code><IfModule mod_rewrite.c> | ||
+ | RewriteEngine on | ||
+ | RewriteRule (.*) http://localhost:3000/$1 [P,L] | ||
+ | ProxyPass / ws://localhost:3000/ | ||
+ | </IfModule></code> | ||
+ | |||
+ | Rebuild the Apache configuration file, and restart LSWS: | ||
+ | |||
+ | <code>/scripts/buildhttpdconf | ||
+ | |||
+ | /usr/local/lsws/bin/lswsctrl restart</code> | ||
===== Final Test: The Front End ===== | ===== Final Test: The Front End ===== |