php ratchet websocket SSL connect?

后端 未结 9 2237
遥遥无期
遥遥无期 2020-11-27 03:30

I have a ratchet chat server file

use Ratchet\\Server\\IoServer;
use Ratchet\\WebSocket\\WsServer;
use MyAppChat\\Chat;
require dirname(__DIR__) . \'/vendor/         


        
9条回答
  •  广开言路
    2020-11-27 03:41

    I was trying to do this for a subdomain. Ex: Redirect realtime.domain.org to localhost:8080 from apache.

    Here's how it worked. You can create a virtual host and proxy pass that.

    
        ServerName realtime.domain.org
    
        RewriteEngine On
        RewriteCond %{HTTP:Connection} Upgrade [NC]
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
    
        ProxyPreserveHost On
        ProxyRequests off
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/
    
    

    So, all the requests to realtime.domain.org can be redirected to port 8080, where you can run the WebSocket handler.

提交回复
热议问题