poisonborz's picture

The default Nextcloud image, when deployed, will include /index.php in the url. It took quite some time to figure out how to fix this, and I just wanted to share the solution for others. This should be maybe be the default for the Turnkey installation, or at least should be displayed in the Readme/Docs of the image.

  • This is for root domain (eg. example.com or nextcloud.example.com). If you have a "/nextcloud" type subfolder path, change it accordingly.
    In /var/www/nextcloud/config.php. add the line 'htaccess.RewriteBase' => '/'
  • Change owner/chown of /var/www/nextcloud/.htaccess from root to www-data (temporarily)
  • being in the /nextcloud folder, run this:
    runuser -u www-data php occ maintenance:update:htaccess
  • change owner of .htaccess back to root

 

 

Forum: 
Jeremy Davis's picture

Awesome, thanks for this tweak! :) I agree that it'd be good to add by default. I've written it up as a feature request on our tracker.

FWIW, after I wrote that up, it occurred to me that you could probably run the "php occ ..." command as root. Assuming that works, then changing (and changing back) the permissions of the .htaccess file wouldn't be necessary...

poisonborz's picture

The chown-changing step is a quick workaround for whoever finds this forum post, for the solution during install or in docs there could be a better way... executing it as root will yield a permission error. I think it has to do with the fact that the NC console utility and all files are owned by www-data, but the single .htaccess file by root.

Add new comment