Trying to make sense of an Apache configuration that's all over the map. The relevant files are:
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*.conf (several files, including ssl.conf)
/etc/httpd/virtualhosts.d/*.conf (1 file)
The files in conf.d/ and virtualhosts.d/ are pulled in via
Include directives after
NameVirtualHost *:80, and two vhosts are also defined in httpd.conf itself.
I would like the server defined by a virtual host in ssl.conf to be considered the "default" server, meaning if Apache reports a server error or other problem, I would like it to come on behalf of this server. The main problem is that even though the vhost in ssl.conf is defined with
<VirtualHost _default_:443>, one of the non-SSL vhosts (the one in virtualhosts.d/, actually) shows up as the server name in client error messages (Not found, Forbidden, etc.).
Apache says the config syntax is okay and reports the following:
Code:
# apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 main.site.com (/etc/httpd/conf.d/ssl.conf:88)
*:80 is a NameVirtualHost
default server some.vhost.com (/etc/httpd/virtualhost.d/some.vhost.com-80:1)
port 80 namevhost some.vhost.com (/etc/httpd/virtualhost.d/some.vhost.com-80:1)
port 80 namevhost another.virtualhost.com (/etc/httpd/conf/httpd.conf:1028)
port 80 namevhost main.site.com (/etc/httpd/conf/httpd.conf:1040)
Here, main.site.com:443 is correctly defined as _default_, but some.vhost.com shows up as the "default server" and the server name displayed in error messages. main.site.com:80 contains only a rewrite to send all requests to port 443. I tried adding a default directive there, in case a default on port 80 was required, but Apache returned warnings:
Code:
[warn] _default_ VirtualHost overlap on port 80, the first has precedence
[warn] NameVirtualHost *:80 has no VirtualHosts
Is there a way to tell Apache to return the
_default_:443 vhost as the "default server"?