Rocket.Chat в Ubuntu 16.04 + прокси-сервер Apache2 SSL не работает

Проблема: Rocket.Chat Server отлично работает по HTTP, но, к сожалению, я не могу заставить его работать с HTTPS и обратным прокси-сервером Apache2...

Apache-Config sub.example.com (Rocket.Chat):

> <VirtualHost IP:443>
> 
> ServerAdmin webmaster@sub.example.com
> ServerName sub.example.com
> ServerAlias www.sub.example.com
> ErrorLog /var/log/chat.sub.example.com_error.log
> TransferLog /var/log/chat.sub.example.com_access.log
> LogLevel info
> SSLEngine On
> SSLCertificateFile /etc/letsencrypt/live/sub.example.com/fullchain.pem
> SSLCertificateKeyFile /etc/letsencrypt/live/sub.example.com/privkey.pem
> 
> <Location />
>         Order allow,deny
>         Allow from all
> </Location>
> 
> RewriteEngine On
> RewriteCond %{HTTP:Upgrade} =websocket [NC]
> RewriteRule /(.*) ws://localhost:3000/$1 [P,L]
> RewriteCond %{HTTP:Upgrade}           !=websocket [NC]
> RewriteRule /(.*) http://localhost:3000/$1 [P,L]
> 
> ProxyPassReverse / http://localhost:3000/
> </VirtualHost>

В верхней части работает example.com, который также обслуживает другой контент через https:

<VirtualHost *:443>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

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

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]


  </VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Caddy-Files выглядит так:

> https://sub.example.com
> proxy / localhost:3000 {
>   websocket
>   transparent
> }

Caddy-Status (каждый раз, когда я редактирую caddy-файл по умолчанию для настроек над сервисом, похоже, происходит сбой):

https://cloud.githubusercontent.com/assets/26794734/24507484/def39ce6-1560-11e7-8233-265c5a833b39.png

Резюме (/./ -> Ссылка-Удаление):

[Веб-сайт] HTTPS https:/./example.com -> Рабочая

[Rocket.Chat] HTTP http:/./sub.example.com:3000 -> Рабочая

[Rocket.Chat] HTTPS https:/./sub.example.com:3000 -> НЕ РАБОТАЕТ (ERR_CONNECTION_CLOSED)

Кто-нибудь может дать мне подсказку? Я думаю, что это проблема топ-домена и VirtualHosts... Большое спасибо!

1 ответ

У меня такая же проблема с centos7 и apache, решаемая установкой промежуточного сертификата! Кажется, мобильному API это нужно. Протестируйте SSL вашего сервера с помощью https://www.ssllabs.com/ssltest/index.html. Если в тесте сертификата появляется ошибка "цепочка не завершена", используйте https://certificatechain.io/ для ее устранения.

Вставьте на последний сайт свой действительный ssl-сертификат и используйте результат для своего промежуточного сертификата. Перезапустите httpd, еще один тест в ssllabs должен выглядеть нормально в цепочке сертификатов, и мобильное приложение звучит хорошо.

Другие вопросы по тегам