Kathaki
Kathaki

Reputation: 11

Nextcloud installation in subfolder - Redirect in Apache2

I moved my Nextcloud installation from one server to another and "made the mistake" of changing the folder structure. The Nextcloud installation is now under "/var/www/html/nextcloud/" and no longer under "/var/www/html/".

I've got everything working so far but fail at the URL. When I enter example.com, I end up on the Apache 2 default page. To reach Nextcloud I have to go to example.com/nextcloud

I would like domain.com to automatically redirect to example.com/nextcloud.

What makes me wonder is the apache2 configuration in general.

I have the default config with 000-default.conf in which I have not changed anything. Additionally I have created a config nextcloud.conf with

<VirtualHost *:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/nextcloud

    Redirect permanent "/" "https://example.com/"
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<Directory /var/www/html/nextcloud>
Options +FollowSymlinks
AllowOverride All
</Directory>

Apart from Nextcloud, ONLYOFFICE Documentserver will run in a docker on the server. This should be accessible under subdomain.example.com.

Do I really need the nextcloud.conf in the constellation or should I edit the 000-default.conf for the Nextcloud installation and only use another config for ONLYOFFICE?

I followed these instructions during the whole procedure

https://help.nextcloud.com/t/howto-what-to-do-for-having-nextcloud-onlyoffice-on-the-same-host/33192

I hope that I was able to express myself halfway understandable and that you can help me out :) The whole process caused me to lose a lot of nerves.

Thanks a lot and have a nice weekend!

Kathaki

Upvotes: 0

Views: 3153

Answers (1)

Alexandre Anriot
Alexandre Anriot

Reputation: 141

I think that you use ProxyPass / ProxyPassReverse (and ProxyPassReverseCookiePath ?) settings instead. You have several examples on NextCloud Help.

Also, don't forget to update the datadirectory setting to /var/www/html/nextcloud/ in config.php if its value is still /var/www/html/.

Upvotes: 0

Related Questions