- Server: Debian 9
- Webserver: Apache2
My DNS A Record is *.domain.tld to my IP I solve my apache vhosts by macro. If I type in a subdomain that does not exist, it will display the page of the next vhost file instead of a default page or an error.
Here is my 000-default.conf
ServerSignature Off
<Directory /home>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www
</VirtualHost>
<Macro Host $name $domain>
<VirtualHost $domain:80>
ServerName $domain
ServerAlias www.$domain
DocumentRoot /home/$name/html
AssignUserID $name $name
CustomLog /home/$name/logs/access.log vhost_combined
ErrorLog /home/$name/logs/error.log
<Directory /home/$name/html>
php_admin_value open_basedir /home/$name/html/:/var/lib/php/:/usr/share/php/:/usr/sbin/sendmail:/tmp
php_admin_value upload_tmp_dir /home/$name/html/tmp/
php_value upload_max_filesize 500M
php_value post_max_size 525M
php_value memory_limit 2000M
php_flag "output_buffering" Off
</Directory>
</VirtualHost>
</Macro>
<Macro SSLHost $name $domain>
<IfModule mod_ssl.c>
<VirtualHost $domain:443>
ServerName $domain
ServerAlias www.$domain
Alias /analytics /home/matomo/html
DocumentRoot /home/$name/html
AssignUserID $name $name
CustomLog /home/$name/logs/access.log vhost_combined
ErrorLog /home/$name/logs/error.log
<Directory /home/$name/html>
php_admin_value open_basedir /home/$name/html:/var/lib/php/:/usr/share/php/:/usr/sbin/sendmail:/tmp
php_admin_value upload_tmp_dir /home/$name/html/tmp
php_value upload_max_filesize 500M
php_value post_max_size 525M
php_value memory_limit 2000M
php_flag "output_buffering" Off
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias $domain
SSLCertificateFile /etc/letsencrypt/live/$domain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/$domain/privkey.pem
</VirtualHost>
</IfModule>
and as sample a macro vhost (001-sub.domain.tld.conf:
Use Host myXYuser sub.domain.tld
Use SSLHost myXYuser sub.domain.tld
So as example now the sub.domain.tld exists When I type "xy.domain.tld" it display sub.domain.tld.. How can I avoid this?
Thanks in advance,