2016-07-29 8 views
0

나는 내 서버에서 래칫 웹 소켓을 사용합니다. 그것은 SSL없이 잘 작동하지만 SSL과 함께 작동시켜야합니다.래칫 웹 소켓 SSL

이 나는이 stackoverflow post을 읽었습니다. 불행히도 내 PAAS의 지원은 httpd.conf를 사용하지 않습니다. 그들은 .htaccess에 ProxyPass를 직접 추가하라고 조언했다.

여기에 내가 서버가 데비안을 기반으로 우리는 아파치 웹 서버를 사용하는 같은 서버에 우리가 아파치를 사용하지 않는 것을 알려 드리고자합니다 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/서버 충돌한다.

어떤 해결책이나 요령이 있습니까?

업데이트 : 우리가 그것을에만 서버 구성 또는 가상 호스트 설정에 사용되어야한다 htaccess로에서 ProxyPass로 사용할 수 없습니다 이해하는 바로는

.

나는 지원에게 설명하려고 노력하지만 그들은 이해하지 못하는 것 같습니다.

분명히 .htaccess에서 ProxyPass를 사용하는 것은 금지되어 있습니다.

"ProxyPass로 및 ProxyPassReverse은 서버 설정과 가상 호스트 컨텍스트에서 사용할 수 있습니다." 당신은 서버 설정에서이 줄을 추가 할 수 없습니다 따라서 경우

는이 가상 호스트 컨텍스트에 추가 할 수 있을까?

그들의 대답 :

내가 다시 는 라쳇 또한 서버에서 실행 WebSocket을 할 수 있도록 아파치 모듈과 방화벽 규칙을 포함하는 서버 수준의 모든 설정을 검토 한 바와 같이

우리가 방화벽에 추가 한 규칙은 모든 트래픽이 외부 포트 8000에 사용할 수 있음을 나타냅니다 나는 충분한에 가 웹 소켓에 대한 외부 연결을 허용해야한다 생각합니다. 당신이 (HTTPS의 경우) 다른 포트를 사용하여 연결을 만들려고 노력처럼

는 지금, 그것은 보인다. 우리가 서버 설정 및 구성을 검토 했으므로 모두 좋을 것 같습니다.

개발자가이 과정에 참여할 수 있다면 코드 레벨이 보다 훨씬 뛰어나다는 것을 잘 알게 될 것이므로 매우 감사하게 생각합니다.

지금 던질 것이다 WSS와 연결을 시도 :

웹 소켓 연결에 'WSS : //127.198.132.141/wss2/를'실패 웹 소켓 열고 악수

을 취소

ws와 함께 http를 사용하는 것이 잘 작동하는 동안. 가상 호스트 추가에

+0

당신은이 문제를 해결 했습니까? 나는 동일한 문제가있다 – Andreah

+0

안녕하세요, 불행히도 내 호스트에 많이 구성 할 수 없기 때문에 아닙니다. 지금 SSL 사용을 중단해야했습니다. 나는 여전히 해결책을 찾는데 관심이있다;). – Brieuc

+0

포트 8888을 사용하여 문제를 해결합니다. 성공하지 않고 8080을 사용해 보았습니다. 나는 또한 아스 워버 (aswer)를 쓴다. – Andreah

답변

1

:

ProxyPass /wss2/ ws://yourdomain.xxx:8888/ 이 (포트 8888으로 시도)

아파치 서비스를

가상 호스트의 예를 다시 시작 깜빡하지 않습니다

<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> 

을 여기에 전체 작동 예제을 찾을 수 있습니다. 0 https://github.com/ratchetphp/Ratchet/issues/100