views:

2199

answers:

3

Hi,

I'm trying to set up a virtual host on a new VPS using apache 2.x on a Ubuntu server.

When starting apache I get the error " xxx.241.214.xxx:80 has no VirtualHosts", and the url for the site still points to the default location which means my virtual host file isn't taking effect:

<VirtualHost xxx.241.214.xxx:80>
ServerName xxx.co.uk
ServerAlias www.xxx.co.uk
DocumentRoot /var/www/vhosts/xxx.co.uk/httpdocs/xxx.co.uk
</VirtualHost>

Please help, I'm no good at all this server config stuff.

A: 

I always use

<VirtualHost *>

(and ISTR always having problems specifying the IP and port number, which I think is why I do it that way now).

Richard Harrison
+1  A: 

I know its been a while since you posted your question but I thought id throw in my thoughts

We currently run a few internal sites here for different purposes, all of them listen of standard port 80 and apache is set up simply as follows

Listen 80

NameVirtualHost *:80

# Site 1 Comment

<VirtualHost *:80>
  ServerName site1.intranet
  ServerAdmin [email protected]
  DocumentRoot /var/www/html/site1
</VirtualHost>

#  Site 2 Comment

<VirtualHost *:80>
  ServerName site2.intranet
  ServerAdmin [email protected]
  DocumentRoot /var/www/html/site2
</VirtualHost>

Our DNS is set up to route http://site1.intranet etc to the IP of the apache server and the apache config does the rest.

rodent43
A: 

Hello,

My question is: Does each virtual host have to have a specified DocumentRoot, which naturally has to be different for the VHosts.

The point of my question is: If the master server had /var/www as its DocumentRoot, and then creating symbolic links for all the other servers available, and specifying each VHosts Root as needed, would this work? Because I am having problems with the browser not serving up the pages even though I have specified all these settings.

I need some help urgently, as its driving me round the bend.

See example below:

Listen 80

NameVirtualHost *:80

Site 1 Comment

ServerName www.site1.com ServerAdmin [email protected] DocumentRoot /home/Public/site1

Site 2 Comment

ServerName www.site2.com ServerAdmin [email protected] DocumentRoot /home/Public/site2