turnkeylinux / tracker

TurnKey Linux Tracker
https://www.turnkeylinux.org
70 stars 16 forks source link

Nextcloud - don't include /index.php by default in the url #1547

Open JedMeister opened 3 years ago

JedMeister commented 3 years ago

poisonborz noted in the forums that the Nextcloud/Apache conifg can be tweaked to rewrite the address bar URL that the user sees (and remove the index.php). As suggested/requested, we should add this by default for the v16.1 release IMO.

To repeat the steps required as script:

cd /var/www/nextcloud
echo "'htaccess.RewriteBase' => '/'" >> config.php
chown www-data .htaccess
runuser -u www-data php occ maintenance:update:htaccess
chown root .htaccess
systemctl restart apache2

FWIW, this requires mod_rewrite and mod_env (both enabled in the Nextcloud build code by default).

vondrt4 commented 3 years ago

Please do not do this if it is not supported by original documentation. NextCloud has a lot of plugins and integrations. You need to test: WebDav mounts, CalDav/CardDav integration Video calls and a load of other plugins External sharing links - will they still be generated with index.php in the name? Maybe you need to go into the PHP source code to change it and that would be a lot of work.

poisonborz commented 3 years ago

Just to chime in, having index.php in the url is "normal" for PHP apps on apache setups not having mod_rewrite on, see eg. Wordpress or Drupal. In no sensible platform/app is the "index.php" part hardcoded (or the base url for that matter), so this shouldn't cause any issues.

Besides .htaccess generation, there also seems to be another way mentioned in the docs, namely setting 'htaccess.IgnoreFrontController' => false in the config.

vondrt4 commented 3 years ago

Hmm, the .htaccess generation is automatic and is mentioned in a paragraph just above the config option you mention. Nevertheless, all the things I wrote should be tested before shipping it in the image.

poisonborz commented 3 years ago

So the generation is based on the config - I suppose simply adding 'htaccess.RewriteBase' => '/' before the installation would then also suffice. The docs should then contain a note that if someone would want a /nextcloud-like url, he should change the line and re-generate .htaccess.

By the way I'm using NC like this for a few days, installed multiple apps - it's not a strict empirical test, but something noteworthy at least :v

JedMeister commented 3 years ago

Apologies on slow response to this discussion. Thanks @vondrt4 for noting your concerns. The points that you raise are valid. Given that, I think I might just document this for now. Perhaps we could also provide it as a confconsole plugin?