1

Hi I have this problem with a new rackspace cloud server.

i have an apache where the ServerName is set to mydomain.com the DocumentRoot is /var/www/html

and I have a few virtual hosts too which I want to have in this server

I got a seperate file called hosts.conf in the /etc/httpd/conf.d/ the content of it looks like this

NameVirtualHost *:80 <Directory /var/domains> AllowOverride None Options None Order allow,deny Allow from all </Directory> <VirtualHost *:80> ServerName mydomain-1.com DocumentRoot /var/domains/mydomain-1.com ServerAlias www.mydomain-1.com ServerAdmin [email protected] </VirtualHost> <VirtualHost *:80> ServerName mydomain-2.com DocumentRoot /var/domains/mydomain-2.com ServerAlias www.mydomain-2.com ServerAdmin [email protected] </VirtualHost> 

so the problem is when I add try to access the three websites,

mydomain.com, mydomain-1.com and mydomain-2.com, all of them returns the mydomain.com content.

any help is appreciated

thanks

10
  • If your OS is debian based, you could use a2makesite code.google.com/p/a2makesite Commented Dec 24, 2011 at 9:43
  • the os is centos Commented Dec 24, 2011 at 9:46
  • Do you see any error? My VirtualHost entry is like <VirtualHost *> and I have NameVirtualHost * and Listen 80 in my apache configuration files. Commented Dec 24, 2011 at 9:52
  • 1
    What's the output of /usr/sbin/apache2ctl -t -DDUMP_VHOSTS? Commented Dec 24, 2011 at 10:06
  • 1
    Then check the access logs for each domain. If not so configured, then do this. It should tell you whether or not a request actually reaches the vhost and more importantly what the HTTP response code is. Commented Dec 24, 2011 at 11:22

1 Answer 1

0

Try NameVirtualHost ing each specifically:

NameVirtualHost mydomain-1.com:80 NameVirtualHost mydomain-2.com:80 

and add the server name in the VirtualHost directive:

<VirtualHost mydomain-1.com:80> 
3
  • that didnt work Commented Dec 24, 2011 at 10:04
  • @nivanka are you sure hosts.conf is being parsed? Commented Dec 24, 2011 at 10:05
  • yes it is being parsed Commented Dec 24, 2011 at 10:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.