nextCloud on external disc: 403 Forbidden error

I am trying to install nextCloud on my Raspberry Pi. I want to have the nextCloud folder on an LUKS encrypted external disc while apache is on the 8 GB SD card.

I downloaded the newest nextCloud archive yesterday (Version 11) and put it on the external disc. I installed apache2 and all the php modules via apt.
Then I mounted the external disc in the path /mnt/usbdrive. On that disc is the nextCloud folder (/mnt/usbdrive/nextcloud) but the file that is displayed when accessing the server is /var/www/html/index.html.

(edit) I used the command sudo chown -R www-data:www-data /mnt/usbdrive after putting the nextcloud folder on the disc.

I used the nextCloud install guide but in this step when I had to create the /etc/apache2/sites-available/nextcloud.conf file with the content

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud


I changed every /var/www/nextcloud to /mnt/usbdrive/nextcloud.

Then I tried accessing the server via IPADDRESS/nextcloud before restarting apache which displayed an 404 error. Then I restarted apache using service apache2 restart and now it displays an 403 error and says:


You don't have permission to access /nextcloud/ on this server.
Apache/2.4.10 (Raspbian) Server at rpicloud Port 80

Does anyone know how I can fix this?

A permission issue :smirk:

Can you access the nextcloud folder as www-data user?

sudo -u www-data ls -lisa /mnt/usbdrive/nextcloud

Thanks for your reply! I forgot to mention that I also used the command sudo chown -R www-data:www-data /mnt/usbdrive on the disc.

I tried using the command sudo -u www-data ls -lisa /mnt/usbdrive/nextcloud and it displays the files in the nextcloud folder.

And the code-snipped you posted above is it within the SSL (port 443) vhost and not the standard (port 80) vhost? And you access via SSL as well (https://IPADDRESS/nextcloud)?

The 403 error appears when I try to access the server using the browser on my desktop PC. The hostname of the Server is RPiCloud so I tried both http://IPADDRESS/nextcloud and http://rpicloud/nextcloud but I still get the 403 error. At the botton it says Port 80.

I also tried https://IPADDRESS/nextcloud and https://rpicloud/nextcloud but then Firefox says that it can’t connect to the server.

Also when I try to access http://IPADDRESS I get the Apache2 Debian Default Page which is stored in /var/www/html/index.html. I don’t get that page when using https://.