After setting up my Ubuntu Server as a home server I wanted to make Nextcloud mount my network shared folder so I could alter files through the Nextcloud interface.
First I installed the Nextcloud removable media snap with,
sudo snap connect nextcloud:removable-media
which meant that the Nextcloud Snap would be able to access removable media (eg; anything mounted under /media). I then created a folder in media to mount to,
sudo mkdir /media/Public
and used bind to bring the two together.
sudo mount -o bind /home/<username>/Public/ /media/Public
I then tested the two were bound properly with,
ls /media/Public
To see if my files were there. Amazingly it all worked so logged into the admin account on Nextcloud, went to Settings in the right hand menu and then External Storages on the bottom left of the screen (If it isn’t there you may need to enable the module in Apps).
In Externals Storage add a folder name, choose Local for External Storage, Authentication (none), Put the file path in configuration (eg; /media/Public), choose what users you want it available for and click the tick.
If it goes green all should be well and you should be able to access the folder through the External Storage menu after logging in. To make the bind permanent you need to add it to your fstab so it lasts through reboot.
To do this make a backup of fstab,
sudo cp /etc/fstab /etc/fstab_backup
open up fstab in nano with,
sudo nano /etc/fstab
and add a line at the bottom. My one is,
home/<insert username>/Public /media/Public/ none bind
Yours can be whatever you want as long as you follow the same process. Be careful if you are not used to fstab, it is used to mount your disks when booting so if you don’t do it right then your computer won’t boot so make a backup first.
Before reboot you can test the config with,
sudo mount -a
to see if it gives any errors.
Update
This was now written a little while ago and there is also a Configuring External Storage (GUI) guide that is updated to the latest version in the Nextcloud official docs so that may well be helpful for you to read.