Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple sites on server 1

Status
Not open for further replies.

nappaji

Programmer
Mar 21, 2001
76
US
I have an apache server on a linux machine.
I have configured the /var/lib/apache/conf/httpd.conf file , so that the root directory is /usr/web.

If I want an entirely new web page to reside on this server, without disturbing the existing one, how do I configure it. What are the files that need to be changed???
Say, If i want the page to reside under /usr/web2, how do I do it???

thanks
 
Make a virtualhost!

First go to the section of the httpd.conf file and look for the virtualhosts section (close to the bottom/end).

Next create a virtualhost container for your site like so:

<VirtualHost 162.182.29.1>
ServerName DocumentRoot /usr/web/newsite
</VirtualHost>

Then lastly, create the directory, /usr/web/newsite and put your pages in. Restart the apache server. Voila!


Hope this helps!!

Rninja
 
hello,
If one uses VirtualHost and only has one ip address for his/her web server and dns server, do you have to put new host in the hosts file which requires a different ip address.
When I try to add host to hosts file using the same ip after I save the change it will only keep one host name associated to the one ip??
Is it not needed to add host if using virtualhost?
thank you..
 
This is a pretty dead thread... I am trying to help sarm.

You create Alias IP addresses for each virtual site you want to add. If you have Xwindows installed, open the Network Configuration tool, click on Interface, highlight your network card (eth0) and click on Alias at the bottom of the window. It'll give you the option of creating a class C alias IP address. It'll show up as eth0:0. You do NOT add another host in the /etc/hosts file. You add your virtual server through the Apache Configuration tool.

Example: my RedHat server has an IP address of 192.168.123.135 on eth0. I have two Alias that are eth0:0 at 192.168.123.201 and eth0:1 at 192.168.123.202 for my two web sites.

You have to run your own DNS server to use virtual hosting...

 
To sarm,

I forgot, not everyone is using IP-based virtual hosting. If you are not using class C IPs, you have to use Name-based virtual hosting, in which case you don't need to alias your eth0 to create another IP. But you DO need a DNS server (BIND) to do it.

I can provide links to lots of different articles that aren't much use by themselves because they are ALL incomplete. But when you put them all together, you can get the picture.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top