I have a apache 2.4.38 webserver, running on my Debian 10 Buster server. In my /var/www/html, I have a index.html file, and a folder "nextcloud", with a nextcloud instance installed. If I type the IP of my server into my browser, the index.html file shows(that's the behavior I want). However, if I type my domain name into my browser, only the domain, without adding /nextcloud to the URL, nextcloud loads. This is unwanted behavior. When simply typing in my domain name, without specifying a subfolder, I want my custom index.html to show. In /etc/apache2/sites-enabled, I have 3 files:
000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
nextcloud.conf
<VirtualHost *:80>
ServerAdmin MY_EMAIL_CENSORED
DocumentRoot /var/www/html/nextcloud/
ServerName MY_DOMAIN_CENSORED
Alias /nextcloud "/var/www/html/nextcloud/"
<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =MY_DOMAIN_CENSORED
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
nextcloud-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin MY_EMAIL_CENSORED
DocumentRoot /var/www/html/nextcloud/
ServerName MY_DOMAIN_CENSORED
Alias /nextcloud "/var/www/html/nextcloud/"
<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/MY_DOMAIN_CENSORED/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/MY_DOMAIN_CENSORED/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Thank You very much for your time, attention and help!
Simon