How to fix data directory warning on Nextcloud

After installing Nextcloud, sometimes we got the following error on Admin page: “Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. It is strongly recommended that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.” Its not good because our valuable data can be accessed by unauthorized person. To fix this, please follow these steps.

Edit the Apache configuration file

Depends on your Apache settings, you may need to create a new configuration file for Nextcloud installation. In my case, I would create a configuration file called nextcloud.conf under /etc/apache2/sites-available directory.

Now paste these lines and make sure you change the directory to match with your installation directory

Make sure AllowOverrideAll is there. Close and save the file.

Now create symlink of this nextcloud.conf to /etc/apache2/sites-enabled/nextcloud.conf

Now we need to enable rewrite module:

Finally restart apache web server

Now the warning should be gone and you are good to go.

Consider to read the following tutorial prior to this post.

How to install Nextcloud on Debian 9

Be the first to comment

Leave a Reply

Your email address will not be published.