Set up security websocket (wss) in vesta + php + centos

  1. Enable mod_proxy and mod_proxy_wstunnel module in apache.
    • vi /etc/httpd/conf.modules.d/00-proxy.conf
    • Remove '#' from the beginning of these two lines. If you can't find these two lines from the file, please add them manually.
      LoadModule proxy_module modules/
      LoadModule proxy_wstunnel_module modules/
  2. Add configuration for the apache
    • vi /home/{username}/conf/web/
    • Assume your websocket service on the port 2000. Add the following inside VirtualHost
      # Websocket proxy
      # wss redirects to working ws protocol
      ProxyPass /wss ws:// retry=0 keepalive=On
      ProxyPassReverse /wss ws:// retry=0
  3. Restart apache services
  4. Now, you can access your wss service form the link like this "wss://"