I want to set up a subdomain using virtual hosts. I have altered the httpd.conf file as follows, but I get a "can't find server" error when I try to access the url. I'm running Centos 5.5.
NameVirtualHost *:80 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. # # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *:80> # ServerAdmin email@example.com # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #</VirtualHost> <VirtualHost *:80> ServerName www.mydomain.com DocumentRoot /var/www/html/ </VirtualHost> <VirtualHost *:80> DocumentRoot "/var/www/vhosts/test_mydomain_com/" ServerName test.mydomain.com ErrorLog logs/test_mydomain_com-error_log CustomLog logs/test_mydomain_com-access_log common </VirtualHost>
- Checked the syntax is valid by "service httpd configtest"
- Restarted Apache
- Checked that the DocumentRoot described above does indeed get to the folder I have my index.php file in for the subdomain.
I'm suprised that even though it can't find the subdomain, it doesn't get routed to the www.mydomain.com area because that's what I thought that I'd set it up to do with the first virtual host statement.
I'm trying to access the subdomain by:
Do I need to do anything to (and thus learn about) the DNS settings to acheive what I want here? Is that what could be going wrong?