1

I have a Linux server with Debian GNU/Linux 9 (stretch) and Apache/2.4.25 (Debian) installed. I wanna host multiple websites on my server. For example one main wesbites and 2-3 smaller websites for friends. I also want a default page to be displayed when a request comes to the web server that is not configured in the VHosts (for Example de IP-Address). For example Welcome on bla bla bla.

I would like to mention that after every change I reloaded the webserver and all file permissions are correct.

My configs:

sites-enabled:

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 admin@vaorra.net
DocumentRoot /websites/www/

<Directory /websites/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        Require all granted
</Directory>

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

openair-seuzach.ch.conf:

<VirtualHost openair-seuzach.ch:80>

ServerName openair-seuzach.ch

ServerAdmin admin@vaorra.net

DocumentRoot /websites/openair-seuzach.ch/
<Directory /websites/openair-seuzach.ch/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        Require all granted
</Directory>

</VirtualHost>

vaorra.net.conf:

<VirtualHost vaorra.net:80>

ServerName vaorra.net

ServerAdmin admin@vaorra.net

DocumentRoot /websites/vaorra.net/
<Directory /websites/vaorra.net/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        Require all granted
</Directory>
</VirtualHost>

My server is running when you want to test it by your self: http://vaorra.net -> Should be come "Coming Soon" http://openair-seuzach.ch -> Should be come "Wartung!"

and when you go on http://alligatorgfx.com/ there also comes "Wartung!" but with this domain I want the 000-Default VHost Site displayed and not the site from the openair-seuzach VHost.

My apache2.conf file:

DefaultRuntimeDir ${APACHE_RUN_DIR}

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Include ports.conf

AccessFileName .htaccess
<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

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

Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

apachectl -S output:

VirtualHost configuration:
149.202.219.157:80     is a NameVirtualHost
         default server openair-seuzach.ch (/etc/apache2/sites-enabled/openair-    seuzach.ch.conf:1)
         port 80 namevhost openair-seuzach.ch (/etc/apache2/sites-enabled/openair-s    euzach.ch.conf:1)
         port 80 namevhost vaorra.net (/etc/apache2/sites-enabled/vaorra.net.conf:1)
127.0.1.1:80           vaorra.net (/etc/apache2/sites-enabled/vaorra.net.conf:1)
*:80                   www.example.com (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

The ServerName in the 000-default.conf file that I entered is from this Stackoverflow-post: https://stackoverflow.com/questions/53467127/apache2-000-default-vhost-wont-be-choosen-by-a-request

I asked the same question on Stackoverflow and the said I should use a dummy ServerName.

Thanks!

closed as off-topic by Rui F Ribeiro, Jeff Schaller, GAD3R, RalfFriedl, roaima Nov 27 '18 at 23:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Jeff Schaller, GAD3R, RalfFriedl, roaima