PDA

View Full Version : Apache web server setup


Stoney X
9th Mar 2005, 08:54
I've got a question for anybody that is familiar with running Apache on Linux. I want to setup multiple web servers to run on a single machine. I only have a single IP address and a single network connection on the box. I currently have a web site up and running, but when I tried to add a second, using VirtualHost, I got into a bit of a knot. If using virtual hosts is the way to go then I'm sure I'll work it out, but if anybody has any advice I would appreciate it.

Regards
Stoney

amanoffewwords
9th Mar 2005, 09:31
Are you editing httpd.conf directly?

My setup uses cPanel which modifies the file directly but once it a while I find it easier to edit it myself.

Hence to add a new virtual host you would copy and paste and existing entry and edit the url/local path etc.

Info on Apache site
here (http://httpd.apache.org/docs/mod/core.html#virtualhost)

hth
Charles

drauk
9th Mar 2005, 10:07
Using Virtual Hosts will definitely do want you want. You want 'Name-based' Virtual Hosts, because you've only a single IP address. It's very straightforward. All you do is:

NameVirtualHost *

<VirtualHost *>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>


This example is from the documentation on the subject which is here (http://httpd.apache.org/docs/vhosts/name-based.html).

Stoney X
9th Mar 2005, 14:13
Thanks amanoffewwords and drauk. Nice to know I'm on the right track. What you say is pretty much what I had gleamed off the net last night. I suspect finger trouble was causing the probs. I'll give it another go tonight.

Regards
Stoney

Stoney X
9th Mar 2005, 19:18
My system is now sorted. Two web sites running on one box. Thanks again for your help.

Regards
Stoney