I am reading: https://httpd.apache.org/docs/2.4/vhosts/examples.html And the statement: "The asterisks match all addresses, so the main server serves no requests. Due to the fact that the virtual host with ServerName
www.example.com is first in the configuration file, it has
the highest priority and can be seen as the default or
primary server. That means that if a request is
received that does not match one of the specified ServerName
directives, it will be served by this first <VirtualHost> ."I read this that if I have a conf file that does not have virtual host directive, it basically fails? If my first virtual host is: <VirtualHost *:80> # Alias /roundcubemail /usr/share/roundcubemail # Alias /webmail /usr/share/roundcubemail ServerName webmail.$your_domain_tld ServerAlias webmail RewriteEngine On ReWriteCond %{HTTP_HOST} =webmail.$your_domain_tld [NC] RewriteCond %{SERVER_PORT} !=443 RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] ExpiresDefault "access plus 10 years" AddOutputFilterByType DEFLATE text/html text/plain text/xml php_admin_flag session.cookie_secure "1" </VirtualHost> any config that does not use virtualhost (that is just an Alias and directory directive) first passes through this first virtual host. And the way to 'fix' this is to have a dummy first virtual directive: /etc/httpd/conf.d/00-init.conf <VirtualHost *:80> ServerName foo.bar.com </VirtualHost> ? |