First of all, sorry for my imperfect English. But let me explain my problem with apache vhosts.
Example: My servername is example.de (/etc/hostname). If I configure for this specific domain my vhost won´t work. It seems apache uses the default-vhost. But I need the default-vhost for pages that are not active on my server. So I can´t use it for the domain example.de
I need a solution for following problem:
- example.de - Should point to /var/www/example (This doesn´t work, because /etc/hostanme)
- example2.de - Should point to /var/www/example2 (This works)
- domain-i-got-but-not-active.de Should point to /var/www/default (This works, but also catches example.de)
I can´t change my hostname, because mails sent from my server will be detect as spam if the server name is not correctly set.
Here is an example of my vhost:
# For default-pages
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/default
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/default>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# Doesn´t work, points to default (above code)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example.de
DocumentRoot /var/www/example
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/example>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# All fine
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example2.de
DocumentRoot /var/www/example2
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/example2>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>