apache - Collabora (docker) 和 NextCloud (snap) 问题在同一台机器上的代理后面

标签 apache docker ssl reverse-proxy nextcloud

经过多天的故障排除后,我决定发布我的情况。我最近在 Ubuntu 18.04 上安装了 NextCloud,一切正常。我做了端口转发并使用 Let's Encrypt(来自 snap 命令)为 NC 创建证书。

然后我决定在同一台机器上安装 Collabora 服务器以使用办公功能。我使用提到的官方协作指南进行安装 here .但是,在本指南中,假定 NC 是手动安装的(不是 snap)。根据指南,我必须安装 Apache(或任何其他代理/Web 服务器)来将流量代理到 NC 或 Collabora。

我认为我的代理配置有问题或 SSL 证书有问题。当 Apache 和 snap 都在运行时,我可以进入 Apache 页面并且 Collabora 应该正在运行,但无法进入 NC 页面。

我可以转到下面的(端口 443)链接并进入该页面(意味着 Collabora 正在响应?)

https://collabora.domain.com/loleaflet/dist/admin/admin.html



但是当访问 NC 域时,浏览器显示“未连接:潜在的安全问题”,并提示证书不适用于我尝试连接的 NC 域,但证书适用于 Collabora 域。如果我停止 Apache 并让 Snap 运行,我可以毫无问题地访问 NC 域(除了我需要再次将端口设置为 443 和 80!这有问题吗?)
我的 Apache 代理配置文件(位于/etc/apache2/sites-available/下)如下:
<VirtualHost *:444>

ServerName nextcloud.domain.com:444
ProxyPreserveHost On
ProxyPass        / https://192.168.1.50/
ProxyPassReverse / https://192.168.1.50/

SSLProxyEngine on
SSLCertificateFile /etc/letsencrypt/live/nextcloud.domain.com/cert.pem
SSLCertificateChainFile /etc/letsencrypt/live/nextcloud.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.domain.com/privkey.pem

</VirtualHost>

<VirtualHost *:443>
ServerName collabora.domain.com:443

# SSL configuration, you may want to take the easy route instead and use Lets Encrypt!
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/collabora.domain.com/cert.pem
SSLCertificateChainFile /etc/letsencrypt/live/collabora.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/collabora.domain.com/privkey.pem
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-$
SSLHonorCipherOrder     on

# Encoded slashes need to be allowed
AllowEncodedSlashes NoDecode

# Container uses a unique non-signed certificate
SSLProxyEngine On
SSLProxyVerify None
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off

# keep the host
ProxyPreserveHost On

# static html, js, images, etc. served from loolwsd
# loleaflet is the client part of LibreOffice Online
ProxyPass           /loleaflet https://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse    /loleaflet https://127.0.0.1:9980/loleaflet

# WOPI discovery URL
ProxyPass           /hosting/discovery https://127.0.0.1:9980/hosting/discovery$
ProxyPassReverse    /hosting/discovery https://127.0.0.1:9980/hosting/discovery

# Main websocket
ProxyPassMatch "/lool/(.*)/ws$" wss://127.0.0.1:9980/lool/$1/ws nocanon

# Admin Console websocket
ProxyPass   /lool/adminws wss://127.0.0.1:9980/lool/adminws

# Download as, Fullscreen presentation and Image upload operations
ProxyPass           /lool https://127.0.0.1:9980/lool
ProxyPassReverse    /lool https://127.0.0.1:9980/lool

# Endpoint with information about availability of various features
ProxyPass           /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities retry=0
ProxyPassReverse    /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities
</VirtualHost>

老实说,这是我第一次设置不知道它是如何工作的代理服务器。我的大部分配置文件都被复制并认为这是问题:) 如果有人可以查看它并指导我正确的方向,那将为我节省大量的头痛和时间。

最佳答案

我在相似的时间内经历了同样的痛苦,最终得到了一个简单的解决方案。
docker的在线说明here是正确的,只是它们省略了 websockets 的启用代理。

a2enmod proxy
a2enmod proxy_wstunnel
a2enmod proxy_http
a2enmod ssl
我必须做的唯一其他更改是将 --cap-add MKNOD 添加到 docker start。
在 Nextcloud 中,我只需要添加 https://collab.example.com在为我的域创建 LetsEncrypt 证书后到 WAPI 服务器地址配置(显然 example.com 不是我的真实域)。

关于apache - Collabora (docker) 和 NextCloud (snap) 问题在同一台机器上的代理后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59287038/

相关文章:

docker - Docker多个端口(前端和后端)不起作用

java - dockerClient.createContainerCMD 未将 Selenium 节点链接到 Hub

Java - HttpClient 库的 Http 身份验证 401 错误

apache - URL 重写无法正常工作

docker - 运行shinyProxy中包含的应用程序时在本地访问文件

ssl - HEROKU 免费层 SSL : You need to be running on either Hobby or Professional dynos to be able to use SNI SSL

python - mitmproxy 反向代理 - 仅在非标准端口上需要 SSL

python - 允许用户 www-data (apache) 从 CGI 脚本调用需要 root 权限的 python 脚本

oracle - ORA-01031 : insufficient privileges Oracle Toad XE 11g

ssl - 为什么图片和 CSS 在 HTTPS 下不显示?