0

I have set up some virtal host to distinguish between my subdomains (/etc/httpd/conf.d/*.conf).

This was working on my old server (Debian 7). But now if I browse the root page I get the first defined VirtualHost displayed.

Also if I am browsing an undefined subdomain I get the first VirtualHost config displayed.

<VirtualHost *:80>

    ServerAdmin admin@example.com

    ServerName sub1.example.com
    ServerAlias sub1.example.com
    DocumentRoot /home/sub/sub_sub1/www
    ServerAdmin Admin
    CustomLog /home/sub/sub_sub1/logs/access.log combined
    ErrorLog /home/sub/sub_sub1/logs/error.log
    LogLevel warn

    <Directory /home/sub/sub_sub1/www>
        Require all granted
    </Directory>

</VirtualHost>
Pascal
  • 2,059
  • 3
  • 31
  • 52

1 Answers1

1

The first defined VirtualHost will serve all the requests that don't get handled by the other ones. You can create a default VirtualHost that handles those requests. To make sure this VirtualHost is the first one, you should name its config-file something like "000-default.conf".

This might also help you: VirtualHost Examples

B0nk3rZ
  • 26
  • 3
  • omg. Yes I have overlooked that file in the old config. There is an 000-default.conf too. Thanks – Pascal Nov 07 '15 at 14:59