Multiple nextcloud path in one webserver

Hi, I’m trying to install 2 different nextclouds on the same webserver and with the same domain.
I would like to get something like this:
install nextcloud1 on /var/www/nextcloud1
install nextcloud2 on /var/www/nextcloud2
I would like to be able to reach the first installation by writing domain.com/nextloud1 in the browser
and I would like to reach the second installation by writing domain.com/nextloud2

is that possible?

thanks for the clarifications

Hi @MattiaTech , I think it is possible. do you use apache ?

for apache you can add this line to your config file in the folder sites-enabled :

Alias /nextcloud1 "/var/www/nextcloud1/"

like this :

DocumentRoot /var/www/nextcloud1/
ServerName example.com

 Alias /nextcloud1 "/var/www/nextcloud1/"

 <Directory /var/www/nextcloud1/>

Hi @MattiaTech

I would recommend to use subdomains like cloud1.yourdomain.tld and cloud2.yourdomain.tld instead of subdirectories and then create separate VirtualHosts for each site.

Create two configuration files…

/etc/apache2/sites-available/nextcloud1.conf and /etc/apache2/sites-available/nextcloud2.conf

…and add the configuration for Nextcloud 1 to … nextcloud1.conf

<VirtualHost *:80>
  DocumentRoot /var/www/nextcloud1/
  ServerName  cloud1.yourdomain.tld

  <Directory /var/www/nextcloud1/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>

…and for Nextcloud 2 to nextcloud2.conf

<VirtualHost *:80>
  DocumentRoot /var/www/nextcloud2/
  ServerName  cloud2.yourdomain.tld

  <Directory /var/www/nextcloud2/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>

Enable both configurations:

a2ensite nextcloud1.conf

a2ensite nextcloud2.conf

Then unpack the Nextcloud files once each into the respective folders and you can setup them induvidually by by accessing them via the respective subdomain in the browser.

2 Likes