I posted this on another thread a while back, but thought it could assist you.
Though it may not be supported as others have pointed out in many threads, I have yet to have an issues changing data directorys; I have changed the data directory many times on many different OwnCloud & NextCloud hosts just fine without any issues. These are the steps I take to move the data directory: (This only works if you have no data to move, as if this is a fresh install)
Run the following command in the Linux shell:
o sudo service apache2 stop
o sudo mkdir /media/user/your_hard_drive/nextcloud_data “or whatever you want to call it?” Remember the /media is your mount point or external hard drive.
o sudo chown -R www-data:www-data /media/user/your_hard_drive/nextcloud_data/
o sudo chmod -R 777 /media/user/your_hard_drive/nextcloud_data/
o sudo chown –R www-data:www-data /media
o sudo nano /var/www/html/nextcloud/config/config.php
o Once you are in the config.php you need to change your data directory. Save file and exit.
o Sudo service apache2 start
Hope this helps you out.