[opensuse] Apache2 default host using virtual hosts
Hi, I'm trying to configure apache2 to use three virtual hosts. I want to use one of them (www.mydomain.com) as the "default server" to serve all the domains that don't match any of the virtual host defined. Using yast I created all the vhosts, I want to use: /etc/apache2/vhosts.d/ ...................................admin.mydomain.com.conf ...................................webmail.mydomain.com.conf ...................................www.mydomain.dom.conf ...................................vhost-ssl.template ...................................vhost.template According to the apache documentation, the default host is the first defined: "Now when a request arrives, the server will first check if it is using an IP address that matches the NameVirtualHost. If it is, then it will look at each <VirtualHost> section with a matching IP address and try to find one where the ServerName or ServerAlias matches the requested hostname. If it finds one, then it uses the configuration for that server. If no matching virtual host is found, then the first listed virtual host that matches the IP address will be used." In opensuse, each virtual host is defined in is own file, so the first defined host depends on the filename, but because yast choose the name based on the domain name, the first domain is "admin.mydomain.com" and not the one I want "www.mydomain.com". Just changing "www.mydomain.com.conf" to "1-www.mydomain.com.conf" makes apache to set the default name the domain I want (however, this is reverted each time I start yast). Is this normal or I'm being hitting by a bug? Thanks in advance! Cheers, -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Oscar Curero wrote:
Hi,
I'm trying to configure apache2 to use three virtual hosts. I want to use one of them (www.mydomain.com) as the "default server" to serve all the domains that don't match any of the virtual host defined.
I have exactly such a setup too.
According to the apache documentation, the default host is the first defined: [snip] In opensuse, each virtual host is defined in is own file, so the first defined host depends on the filename, but because yast choose the name based on the domain name, the first domain is "admin.mydomain.com" and not the one I want "www.mydomain.com". Just changing "www.mydomain.com.conf" to "1-www.mydomain.com.conf" makes apache to set the default name the domain I want (however, this is reverted each time I start yast).
Is this normal or I'm being hitting by a bug?
It's normal. To Apache, the first vhost is the first one loaded. In my setup, I have a vhosts config file named "__default.conf". -- Per Jessen, Zürich (13.0°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Oscar Curero
-
Per Jessen