On Sat, Jun 23, 2018 at 11:22 AM billy noah <billynoah@xxxxxxxxx> wrote:
>
> I am in the process of migrating some sites from a server running Apache 2.4.7 to a new installation (Ubuntu 18) running Apache 2.4.29 and running into some issues with VirtualHost matching.
>
> On my old server I have a config like this:
>
> <VirtualHost 12.34.56.78:80>
> ServerAlias *.dev.example.com
> VirtualDocumentRoot /var/www/dev/%1
> </VirtualHost>
>
> <VirtualHost 12.34.56.78:80>
> ServerName example.com
> ServerAlias www.example.com
> DocumentRoot /var/www/example/
> </VirtualHost>
>
> As you can see, the ServerName directive is intentionally absent from the first host which uses a VirtualDocumentRoot to serve directories based on the subdomain. This has been working fine on the old server.
It's unwise. You should at least pick some nonsense name.
>
> In my new environment everything worked fine at first, but today (no updates, nothing changed), oddly things changed. For some reason apache started matching example.com to the first vhost and after some amount of debugging I have determined that this is due to the lack of ServerName directive. When I add one - anything really - the problem goes away. So to be clear, a working config now looks like this:
>
> <VirtualHost 12.34.56.78:80>
> ServerName anything.dev.example.com
> ServerAlias *.dev.example.com
> VirtualDocumentRoot /var/www/dev/%1
> </VirtualHost>
>
> <VirtualHost 12.34.56.78:80>
> ServerName example.com
> ServerAlias www.example.com
> DocumentRoot /var/www/example/
> </VirtualHost>
Perhaps the reverse DNS of your IP address changed? I don't think
it's directly the "system hostname".
------------------------------------------------------------ ---------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx