2016-07-29 7 views
0

私は自分のサーバー上でRatchet websocketを使用しています。 SSLなしでうまくいきますが、SSLで動作させる必要があります。ラチェットwebsocket SSL

これは私が読んだstackoverflow postです。残念ながら私のPAASのサポートはhttpd.confを使用していません。彼らは私に、.htaccessにProxyPassを直接追加するよう勧めました。

そしてここで私は サーバがDebianのベースとしており、我々はApache Webサーバを使用しているように、サーバー上で、我々はHTTPDを使用していないことをお知らせしたいと思いhttpd.confファイルに次の行を追加することについて。私は htaccessファイルで同じ行を使用することができますか、これについては、 あなたは、開発者に相談することができれば良いと信じています。

# ProxyPass for Ratchet with SSL 
ProxyPass /wss2/ ws://127.198.132.141:8000/ 

# Preventing the app from being indexed 
Header set X-Robots-Tag "noindex, nofollow" 

# Use the front controller as index file. It serves as a fallback solution when 
# every other rewrite/redirect fails (e.g. in an aliased environment without 
# mod_rewrite). Additionally, this reduces the matching process for the 
# start page (path "/") because otherwise Apache will apply the rewriting rules 
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). 
DirectoryIndex app.php 

# By default, Apache does not evaluate symbolic links if you did not enable this 
# feature in your server configuration. Uncomment the following line if you 
# install assets as symlinks or if you experience problems related to symlinks 
# when compiling LESS/Sass/CoffeScript assets. 
# Options FollowSymlinks 

# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve 
# to the front controller "/app.php" but be rewritten to "/app.php/app". 
<IfModule mod_negotiation.c> 
    Options -MultiViews 
</IfModule> 

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    [...] 

あいにくの追加はProxyPass/WSS2/WS://127.198.132.141:.htaccessファイルが間違っていたかのように8000 /サーバーをクラッシュされます。

解決方法やヒントはありますか?

UPDATE:私は、我々はそれが唯一のサーバー設定または仮想ホスト構成で使用されるべきである.htaccessファイルにはProxyPassを使用することはできません理解して何から

私はサポートに説明しようとしましたが、理解できないようです。

明らかに、.htaccessでProxyPassを使用することは禁止されています。

"ProxyPassとProxyPassReverseは、サーバ の設定と仮想ホストコンテキストでのみ使用できます。

したがって、サーバ設定でこの行を追加できない場合は、仮想ホストのコンテキストに を追加できますか。

彼らの答え:

を私は再び もサーバー上で実行することができラチェット WebSocketをを作るためのApacheモジュールとファイアウォールのルールが含まれ、サーバーレベルですべての設定を見直してきたようにファイアウォールに が追加されているというルールは、外部からのすべてのトラフィックがポート8000​​で許可された であることを示しています.WebSocketの外部接続を許可するには、十分なはずです。

今のところ、 (httpsの場合)を使用して接続しようとしているようです。我々はサーバー の設定と構成を見直しているので、すべてが良いと思われます。

このプロセスで開発者を関与させることができれば、彼はコードレベルが よりずっと良くなっているので、彼はあなたをより良く導くことができます。

は今投げますWSSに接続しようとする: 'WSS://127.198.132.141/wss2/' へ

のWebSocket接続に失敗しました:握手を開く のWebSocketが

をキャンセルされました

wsでhttpを使用している間はうまくいきます。あなたの仮想ホストの追加

+0

これを修正しましたか?私は同じ問題を持っています – Andreah

+0

残念ながら、私は私のホスト上で多くの設定を行うことはできません。今はSSLの使用をやめなければなりませんでした。私はまだ解決策を見つけることに興味があります;)。 – Brieuc

+0

私はポート8888を使用して修正しました。私は8080で成功せずに試しました。私もアスワルトを書いて、それが助けてくれることを願う。 – Andreah

答えて

1

ProxyPass /wss2/ ws://yourdomain.xxx:8888/ (ポート8888を試してください)

仮想ホストの例をapacheのサービスを再起動するのを忘れないでください:

<IfModule mod_ssl.c> 
<VirtualHost *:443> 
     ServerAdmin [email protected] 
     DocumentRoot /var/www/html 

     <Directory /var/www/html/> 
      Options Indexes FollowSymLinks 
      AllowOverride All 
      Require all granted 
     </Directory> 

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 

     <IfModule mod_dir.c> 
      DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm 
     </IfModule> 

SSLCertificateFile /etc/letsencrypt/live/yourdomain.xxx/fullchain.pem 
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.xxx/privkey.pem 
Include /etc/letsencrypt/options-ssl-apache.conf 
ServerName yourdomain.xxx 
ProxyPass /wss2/ ws://yourdomain.xxx:8888/ 
</VirtualHost> 
</IfModule> 

ここでは完全な実例を見つけることができます https://github.com/ratchetphp/Ratchet/issues/100

関連する問題