簡體   English   中英

反向代理 (Apache) nextcloud-snap

[英]Reverse proxy (Apache) nextcloud-snap

我一直試圖在反向代理后面更改我的 nextcloud。 它以前在沒有反向代理的情況下工作。 但我想把它移到這個反向代理后面(使用通配符證書)。 所以今天我做了一個全新的安裝,但仍然沒有運氣。 也許有人可以幫助我。

Ubuntu:20.01 LTS Nexcloud 安裝與 snap (Nextcloud 20)

遵循的命令:

$ 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

–> 我將數據目錄更改為我使用的目錄

$ sudo nano /etc/apache2/sites-available/000-default.conf –> 這里我粘貼了你的代碼片段。 在這里我顯示了我完整的 000-default.conf (因為我認為問題可能在這里)。 Ps:我也在運行一個 jellyfin 服務@ 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

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

如果我輸入https://cloud.mydomain.nl它會將我重定向到標准 apache,它可以在 80 端口上運行的網站運行。

我真的希望你能幫助我,因為它讓我發瘋! 非常感謝!

我知道這是一個舊帖子,但我在尋找其他東西時發現了它,所以這里......

我認為這是因為您沒有在 443 上回答的 conf 文件。您需要一個封裝在以下內容中的 conf 文件:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM