I followed all the steps above in Freenas 11.3, with nextcloud-7.2. Once everything is setup, i could not log in using the webapp. This gives a 401 error when trying to grant access.
The apache server configuration was missing modwrite in other to pass the authentication through for the webdav basic auth. as per link: https://help.nextcloud.com/t/client-login-fails-with-401/29378/7
steps required:
nano /usr/local/etc/apache24/httpd.conf
find rewrite_module and uncomment the line: LoadModule rewrite_module libexec/apache24/mod_rewrite.so
return to modify your virtual host file
cd /usr/local/etc/apache24/Includes
Add the following lines into the virtual hosts, it should look something like this (note, i’ve changed my php-fpm to use a socket):
<VirtualHost *:80>
DocumentRoot "/usr/local/www/nextcloud"
ServerName IP
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
DirectoryIndex /index.php index.php
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</VirtualHost>
Boom, the web-app should work and you’ll be able to log in from the application. From reading over the comment thread, the basic authentication is not being passed through, leading to a 401 error.
Based on the comments of Stephen David: