Hey,
First, I want to express my gratitude to the Nextcloud team and the entire community. Youāre all doing a great job !
Iāve recently followed the fork owncloud -> nextcloud when I received my new server hardware. Iāve successfully installed Nextcloud for Debian 10 Buster. But Iām still facing some problemsā¦ Iām convinced most of them are relating to the server configuration. Before exposing you my troubles, letās talk about my environment :
ā¢ Debian 10 Buster
ā¢ Apache2 server
ā¢ Nextcloud installation outside of web root
ā¢ Data folder outside of Nextcloud root
ā¢ Data are on a ZFS drive
ā¢ Workstation on Windows 10
Iām not understanding everything relating to apache2 configuration. Iām facing difficulties with the server configuration files, cause I have 2 differents files in sites-available folder : nextcloud.conf & nexcloud-le-ssl.conf. If I well understand, these configurations are overwrited by .htaccess inside the Nextcloud folder. Can you explain me in which way some of these 2 files in my web directory are useless ? Precision : both of these files has the directive āDav Onā.
Well, letās talk about problemsā¦
Mails
Iām trying to send mails on Nextcloud settings through an OVH account, but itās not working. Here is the message I receive in admin panel :
WebDav
I cannot connect through WebDav, Iām receiving a 401 authentication error. Itās the same error with windows shell, explorer, and CyberDuck.
Caldav & Cardav
I also have the traditional error āYour Web server is not set up properly to resolve /.well-known/caldav/ or /.well-known/carddav/ā
Investigations
Iām quite sure all these problems can be solved with a good configuration of my .htaccess. Iāve read a lot of topics on this forum and on Internet but I cannot find a good example matching to my configuration, and I was not able to solve this problem by myself. It looks like WebDav and mail problems are both relating to this ******* .htaccess file. In particular, I think these troubles are relating to mod_headers and mod_rewrite. Here is the content of my .htaccess :
.htaccess
SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1 RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1 # Add security and privacy related headers Header set X-Content-Type-Options "nosniff" Header set X-XSS-Protection "1; mode=block" Header set X-Robots-Tag "none" Header set X-Download-Options "noopen" Header set X-Permitted-Cross-Domain-Policies "none" Header set Referrer-Policy "no-referrer" SetEnv modHeadersAvailable trueAdd cache control for static resources
<FilesMatch ā.(css|js|svg|gif)$ā>
Header set Cache-Control āmax-age=15778463ā
Let browsers cache WOFF files for a week
<FilesMatch ā.woff2?$ā>
Header set Cache-Control āmax-age=604800ā
php_value mbstring.func_overload 0
php_value default_charset āUTF-8ā
php_value output_buffering 0
SetEnv htaccessWorking true
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} DavClnt
RewriteRule ^$ /remote.php/webdav/ [L,R=302]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^.well-known/host-meta.json /public.php?service=host-meta-json [QSA,L]
RewriteRule ^.well-known/webfinger /public.php?service=webfinger [QSA,L]
RewriteRule ^.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.) remote.php [QSA,L]
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/. - [R=404,L]
RewriteCond %{REQUEST_URI} !^/.well-known/(acme-challenge|pki-validation)/.*
RewriteRule ^(?:.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
DirectoryIndex index.php index.html
AddDefaultCharset utf-8
Options -Indexes
ModPagespeed Off
DO NOT CHANGE ANYTHING ABOVE THIS LINE
ErrorDocument 403 /nextcloud/
ErrorDocument 404 /nextcloud/
Options -MultiViews
RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
RewriteCond %{REQUEST_FILENAME} !.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg)$
RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$
RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$
RewriteCond %{REQUEST_FILENAME} !/remote.php
RewriteCond %{REQUEST_FILENAME} !/public.php
RewriteCond %{REQUEST_FILENAME} !/cron.php
RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php
RewriteCond %{REQUEST_FILENAME} !/status.php
RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php
RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php
RewriteCond %{REQUEST_FILENAME} !/robots.txt
RewriteCond %{REQUEST_FILENAME} !/updater/
RewriteCond %{REQUEST_FILENAME} !/ocs-provider/
RewriteCond %{REQUEST_FILENAME} !/ocm-provider/
RewriteCond %{REQUEST_URI} !^/.well-known/(acme-challenge|pki-validation)/.*
RewriteRule . index.php [PT,E=PATH_INFO:$1]
In addition, there is my nextcloud.conf inside apache directory :
nextcloud.conf
<VirtualHost *:443>
ServerAdmin photo@.fr
DocumentRoot /Nextcloud/
ServerName nc..fr
ServerAlias www.nc.*****.fr
Alias /nextcloud ā/Nextcloud/ā
<Directory /Nextcloud/>
Options FollowSymlinks Multiviews
AllowOverride All
Require all granted
Dav on
SetEnv HOME /Nextcloud
SetEnv HTTP_HOME /Nextcloud
Any help will be much appreciated ! Thankās in advance for your advice
XetYr