Ubuntu 18.04.3, Virtualmin 6.08, Webmin 1.932

Something strange is happening.

If I have nothing in /etc/apache2/sites-enabled

then I can access the Server's Homepage: ns.server.com (/var/www/html)

and ns.server.com/phpmyadmin works fine

If I add a virtual host, or enable a site with

a2ensite domain.com (+ reload apache)

then I got 403 Forbidden when I try to access ns.server.com

and ns.server.com/phpmyadmin download the php file instead of executing it.

If I a2dissite domain.com (+ reload apache)

everything works normally again.


DefaultRuntimeDir ${APACHE_RUN_DIR}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
<Directory /usr/share>
    AllowOverride None
    Require all granted
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
AccessFileName .htaccess
<FilesMatch "^\.ht">
    Require all denied
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
SSLProtocol ALL -SSLv2 -SSLv3
<IfModule php7_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
        DirectoryIndex index.html index.php

Can anybody help figuring out what is going on? Thanks,


So it seems that ns.server.com always points to the public_html of the alphabetically first site that is in /etc/apache2/sites-enabled. If I put index.html there I can access ns.server.com.

Also if I run php as Apache user in the first virtual host then ns.server.com/phpmyadmin works as well.

So there is a workaround, but it is sooooooooo strange :-o

Any ideas?

  • could you perhaps show your apache config file please? – suspectus Nov 13 '19 at 19:42
  • I added the apache config file. – Zoltan Nov 13 '19 at 19:58

In short, as best-practice, define a _default_ virtualhost.


<VirtualHost _default_:*>
    DocumentRoot "/www/default"

You can also add it to an existing virtualhost directive... if needed:

<VirtualHost _default_:*>
    DocumentRoot "/www/some_website"
  • Thanks, this works :) – Zoltan Nov 13 '19 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.