LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache VirualHost multiple domains single IP (http://www.linuxquestions.org/questions/linux-software-2/apache-virualhost-multiple-domains-single-ip-781694/)

zuessh 01-12-2010 08:17 AM

Apache VirualHost multiple domains single IP
 
Hey - I am having a problem with apache's virtualhost directive hosting multiple domains on a single IP with Apache 2.2 on Fedora 11. For example i have domaina.com and domainab.com pointing to the same IP address and have my httpd.conf configured like so:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/domainA
ServerName domaina.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/domainb
ServerName domainb.com
</VirtualHost>

The problem is when i navigate to either domaina.com or domainb.com i get the default Apache page. Its like it is only accepting the default DocumentRoot directive.

Any thoughts or suggestion?

SethsdadtheLinuxer 01-12-2010 08:35 AM

http://httpd.apache.org/docs/2.0/vhosts/

probably don't have your Alias(es) set up correctly

zuessh 01-12-2010 09:01 AM

Thanks for the suggestion but that didn't seem to work either. I added the following lines:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/domainA
ServerName domaina.com
ServerAlias domaina.com www.domaina.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/domainb
ServerName domainb.com
ServerAlias domainb.com www.domainb.com
</VirtualHost>

but the default DocumentRoot is still overriding the virtualhost. Am i just missing the forest for all of the trees?

zuessh 01-12-2010 09:16 AM

:doh:
It was a typo in my httpd.conf


For the directive
<VirtualHost *:80>

I had a . in front of the port rather than a :

:redface:


All times are GMT -5. The time now is 02:55 AM.