简体   繁体   English

反向代理 (Apache) nextcloud-snap

[英]Reverse proxy (Apache) nextcloud-snap

I am stuck with trying to change my nextcloud behind a reverse proxy.我一直试图在反向代理后面更改我的 nextcloud。 It worked before without reverse proxy.它以前在没有反向代理的情况下工作。 But I want to move it behind this reverse proxy (with wild card certificate).但我想把它移到这个反向代理后面(使用通配符证书)。 So today I did a fresh install, but still no luck.所以今天我做了一个全新的安装,但仍然没有运气。 Maybe someone can help me.也许有人可以帮助我。

Ubuntu: 20.01 LTS Nexcloud install with snap (Nextcloud 20) Ubuntu:20.01 LTS Nexcloud 安装与 snap (Nextcloud 20)

Followed commands:遵循的命令:

$ sudo snap install nextcloud
$ sudo nextcloud.manual-install admin ###password###
$ sudo snap set nextcloud ports.http=81
$ sudo nextcloud.occ config:system:set trusted_domains 0 --value=https://cloud.mydomain.com
$ sudo snap connect nextcloud:removable-media
$ sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php

–> I changed the data directory to the one that I use –> 我将数据目录更改为我使用的目录

$ sudo nano /etc/apache2/sites-available/000-default.conf –> Here I pasted your code sniplet. $ sudo nano /etc/apache2/sites-available/000-default.conf –> 这里我粘贴了你的代码片段。 Here I display my complete 000-default.conf (because I think the problem probably here).在这里我显示了我完整的 000-default.conf (因为我认为问题可能在这里)。 Ps: I am also running a jellyfin service @ jellyfin.mydomain.nl (that on works). Ps:我也在运行一个 jellyfin 服务@ jellyfin.mydomain.nl (有效)。 On my host server I made 2 CNAME entries: 1= cloud@mydomain.nl and 2=jellyfin@mydomain.nl在我的主机服务器上,我创建了 2 个 CNAME 条目:1= cloud@mydomain.nl 和 2=jellyfin@mydomain.nl

============ =============

<VirtualHost *:80>
ServerName mydomain.nl
ServerAdmin webmaster@mydomain.nl
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost *:80>
ServerName jellyfin.mydomain.nl

# Uncomment for HTTP to HTTPS redirect
# Redirect permanent / https://DOMAIN_NAME

ErrorLog /var/log/apache2/DOMAIN_NAME-error.log
CustomLog /var/log/apache2/DOMAIN_NAME-access.log combined

If you are not using a SSL certificate, replace the ‘redirect’
line above with all lines below starting with ‘Proxy’
ServerName jellyfin.mydomain.nl # This folder exists just for certbot(You may have to create it, chown and chm> DocumentRoot /var/www/html/jellyfin/public_html

ProxyPreserveHost On

# Letsencrypt's certbot will place a file in this folder when updating/verifyi>
# This line will tell apache to not to use the proxy for this folder.
ProxyPass /.well_known/ !

ProxyPass "/socket" "ws://127.0.0.1:8096/socket"
ProxyPassReverse "/socket" "ws://127.0.0.1:8096/socket"

ProxyPass "/" "http://127.0.0.1:8096/"
ProxyPassReverse "/" "http://127.0.0.1:8096/"

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/mydomain.nl/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.nl/privkey.pem
Protocols h2 http/1.1

# Enable only strong encryption ciphers and prefer versions with Forward Secre>
SSLCipherSuite HIGH:RC4-SHA:AES128-SHA:!aNULL:!MD5
SSLHonorCipherOrder on

Disable insecure SSL and TLS versions

SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

ErrorLog /var/log/apache2/jellyfin.mydomain.nl-error.log
CustomLog /var/log/apache2/jellyfin.mydomain.nl-access.log combined

nextcloud

<VirtualHost *:80>
ServerName cloud.mydomain.nl
ServerAdmin webmaster@mydomain.nl
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine On
RewriteRule ^/.well-known/carddav http://%{SERVER_NAME}/remote.php/dav/ [>
RewriteRule ^/.well-known/caldav http://%{SERVER_NAME}/remote.php/dav/ [R>
RewriteRule ^/.well-known/host-meta http://%{SERVER_NAME}/public.php?serv>
RewriteRule ^/.well-known/host-meta.json http://%{SERVER_NAME}/public.ph>
RewriteRule ^/.well-known/webfinger http://%{SERVER_NAME}/public.php?serv>
ProxyPass / http://localhost:81/
ProxyPassReverse / http://localhost:81/
vim: syntax=apache ts=4 sw=4 sts=4 sr noet

====================== =======================

if I enter https://cloud.mydomain.nl it redirects me to the standard apache, it works website that runs at the 80 port.如果我输入https://cloud.mydomain.nl它会将我重定向到标准 apache,它可以在 80 端口上运行的网站运行。

I really hope you can help me becaus it drives me crazy!我真的希望你能帮助我,因为它让我发疯! Thanks a lot!非常感谢!

I know this is an old post, but I found it whilst looking for something else, so here goes...我知道这是一个旧帖子,但我在寻找其他东西时发现了它,所以这里......

I think this is because you don't have a conf file answering on 443. You need a conf file encapsulated in the following:我认为这是因为您没有在 443 上回答的 conf 文件。您需要一个封装在以下内容中的 conf 文件:

<VirtualHost *:443></VirtualHost *:443>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM