Change default website from apache?

Hello all,

i am new to Nextcloud and i used the automatic install script from GitHub - nextcloud/vm: 💻☁📦 The (official) Nextcloud VM (virtual machine appliance), Home/SME Server and scripts for RPi (4). and i am very happy with the result. Everything regarding Nextcloud is working well now on the second try. I can use Nextcloud with my subdomain

My Problem:

If i surf to MYDOMAIN .com i also land on the nextcloud website with the info “Access through untrusted domain” and the certificate generated by the installation script via letsencrypt for cloud.MYDOMAIN .com (obvoiusly) doesnt match. I want to provide my own website when i surf to MYDOMAIN .com but i am not sure how to configure the apache webserver.

I tried to enable the 000-default.conf where it points to a folder with the website, but then wether nextcloud nor the website is working.

Here are the configs which were generated by the script:

000-default.conf (default not activated):

<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.

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/


<FilesMatch “.php$”>
SetHandler “proxy:unix:/run/php/php7.4-fpm.nextcloud.sock|fcgi://localhost”

    # 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

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

<VirtualHost :80>
RewriteEngine On
RewriteRule ^(.
)$ https://%{HTTP_HOST} [R=301,L]

<VirtualHost *:443>




<FilesMatch "\.php$">
    SetHandler "proxy:unix:/run/php/php7.4-fpm.nextcloud.sock|fcgi://localhost"

# Intermediate configuration
Header add Strict-Transport-Security: "max-age=15552000;includeSubdomains"
SSLEngine               on
SSLCompression          off
SSLProtocol             -all +TLSv1.2 +TLSv1.3
SSLHonorCipherOrder     off
SSLSessionTickets       off
ServerSignature         off

# Logs
LogLevel warn
CustomLog /access.log combined
ErrorLog /error.log

DocumentRoot /var/www/nextcloud

<Directory /var/www/nextcloud>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Satisfy Any

<IfModule mod_dav.c>
Dav off

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud

# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<Files ".ht*">
Require all denied

# Disable HTTP TRACE method.
TraceEnable off
# Disable HTTP TRACK method.
RewriteEngine On
RewriteRule .* - [R=405,L]

# Avoid "Sabre\DAV\Exception\BadRequest: expected filesize XXXX got XXXX"
<IfModule mod_reqtimeout.c>
RequestReadTimeout body=0


SSLCertificateChainFile /etc/letsencrypt/live/
SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
SSLOpenSSLConfCmd DHParameters /etc/letsencrypt/live/


SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"

Is there any way to provide my own website? Can you help me with with the configuration of the apache webserver?

Currently i have for cloud.MYDOMAIN .com and MYDOMAIN .com a DNS “A” record which points to the same IP adress of my server.

Thanks for your help and

After playing sometime with the webserver i found the solution which is very easy.

I created a new file in /etc/apache2/sites-available called “MYDOMAIN .com.conf”

<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName MYDOMAIN .com
ServerAlias www.MYDOMAIN. com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

I enabled the site with the command a2ensite. After that i created a certificate with certbot.
I guess certbot modified my “cloud.MYDOMAIN. com.conf” with this:

RewriteCond %{SERVER_NAME} =www.MYDOMAIN .com [OR]
RewriteCond %{SERVER_NAME} =MYDOMAIN .com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

For now i can access nextcloud via and a “normal” website via

This thread can closed.