1. 程式人生 > >Apache配置WebSocket代理

Apache配置WebSocket代理

  • 引入mod_proxy_wstunnel.so模組,使其可以解析ws、wss協議

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

  • 配置代理路徑跳轉

Include conf/vhosts.conf
<VirtualHost *:80>
    ServerName yangkl-test.com
    ServerAlias *.yangkl-test.com
    ProxyPass "/shentb/websocket"  "ws://127.0.0.1:8080/shentb/websocket"
    ProxyPass "/shentb/"  "http://127.0.0.1:8080/shentb/"
    ProxyPass "/seller/"  "http://127.0.0.1:8080/seller/"
    ProxyPass "/master/"  "http://127.0.0.1:8080/master/"
    ProxyPass "/history/"  "http://127.0.0.1:8080/history/"
    DocumentRoot "E:\phpStudy\WWW\shentb"
  <Directory "E:\phpStudy\WWW\shentb">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
  </Directory>
</VirtualHost>