ServerName mysite.com ... UseCanonicalName Offconf file defining the subdomain:
<virtualhost *:80>
ServerName subdomain.mysite.com
DocumentRoot /var/www/subdomain
ErrorLog /var/log/httpd/subdomain_mysite_com-error.log
CustomLog /var/log/httpd/subdomain_mysite-access.log combined
<directory>
Options Indexes FollowSymLinks
AllowOverride AuthConfig FileInfo Indexes Limit
Order allow,deny
Allow from all
</directory>
< /virtualhost>
Also, FWIW - currently the rDNS lookup on my VPS IP goes to ns1.mysite.com.#Virtual Host for main server <VirtualHost *:80> ServerName www.mysite.com ServerAdmin webmaster@mysite.com DocumentRoot /var/www/html ErrorLog /var/log/httpd/mysite_com-error.log CustomLog /var/log/httpd/mysite-access.log combined </VirtualHost> #Virtual Host to handle non www requests <VirtualHost *:80> ServerName mysite.com ServerAdmin webmaster@mysite.com DocumentRoot /var/www/html ErrorLog /var/log/httpd/mysite_com-error.log CustomLog /var/log/httpd/mysite-access.log combined </VirtualHost>Am I correct in understanding that the entries in my virtual hosts conf file is overriding these entries? So if I were to move these to the top of my virtual hosts conf file - Apache should stop serving subdomain.mysite.com for the VPS IP?
Include conf.d/*.confIf your subdomain is being configured from a file in conf.d, it's actually coming before those stanzas at the end of httpd.conf, because of the include statement's position. Like rhizome said, you can use _default_, or you can put your main server configs in conf.d files lexically earlier than your subdomain config files.
ServerAlias mysite.comin the first stanza and get rid of the second.
You are not logged in, either login or create an account to post comments
If you want mysite.com to be the default, you'll probably have to set up a virtualhost stanza for it, too, and make sure it appears before the subdomain.mysite.com virtualhost stanza. If you're doing this with files in conf.d, numbering them is one way to accomplish that: 00_mysite.com.conf, 10_subdomain.mysite.com.conf, etc.
See the "Main host goes away" section at http://httpd.apache.org/docs/2.2/vhosts/name-based.html for more.
posted by hades at 2:19 AM on March 14