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!

(newbie) multiple instances of apache or virtual hosting help!

Status
Not open for further replies.

Betsy01

Technical User
Jul 11, 2001
9
US
Hello there!

I've got a bit of a problem on my hands. I am working on running 2 completely different small sites off of my home web server. I have a dynamic IP which I use TZO to route traffic to my current IP. I am currently running a Xitami server and it handles both sites nicely but to keep a long story short(er) I would like to run both sites off of Apache.

I am running Win2k as my OS. I have heard that I can run multiple instances of Apache(one for each domain name) but I can't figure out how to set that up. I have succesfully gotten one site running on Apache. Each time I try (with the handy Windows installer) to install a 2nd copy of Apache it just asks me if I want to repair the current install or uninstall...

I also thought of virtual hosting but all the help files I've read seem to say that I need to input an IP address into the Conf file. I can't do that because my IP changes from time to time.

Any ideas or suggestions??
Please help. I've been trying to set this up for a while now to no avail. ;(

Thanks guys!
Betsy
 
Hi,

You can use name-based virtual hosting to achieve this without running multiple apache instances. The only drawback is that the client browser needs to be http 1.1 compliant or otherwise send the fqdn info in the http header. Hence it doesn't work for a few older browsers.

What you do is set up dns to add CNAME records for you virtual hosts such that they all point to the same IP address. Then you put 'VirtualHost' directives in your httpd.conf file like these :

NameVirtualHost 172.16.16.1
<VirtualHost 172.16.16.1>
ServerName vhost1.mydomain.com
DocumentRoot /usr/local/apache/vhost1
ServerAlias vhost1
</VirtualHost>

<VirtualHost 172.16.16.1>
ServerName vhost2.mydomain.com
DocumentRoot /usr/local/apache/vhost2
ServerAlias vhost2
</VirtualHost>

After that will reference the content of /usr/local/apache/vhost1 and will reference the content of /usr/local/apache/vhost2 .

Hope this helps
 
first off let me say thank you for your help.
however I'm afraid I'm not 100% clear with a few things.

1. What are CNAME records?
I have both sites that I'm running registered with internic. So they each have their own domain name.. like mysite1.com and mysite2.com-- does this have anything to do with CNAME?

2. In the example you gave me for Virtual Hosts you still used an IP address. How do I implement that if I have a dynamic IP?

3. If I get my head out of the clouds and manage to figure out the above steps.. will my two sites only be able to be accessed by something like vhost1.mysite1.com? or will they still be able to be accessed by and ?


So sorry. I know my questions are probably really mundane I'm just really trying to figure all this out.

Thank you again for all your help!
Betsy
 
Hi,

1) Cname is short for canonical name (alias) and effectively means the same as the fully qualified domain name. For example is a cname for 64.28.67.150 . It comes from the dns record where you might have something like this in a zone file :

IN A 64.28.67.150
abc.slashdot.org. CNAME
2) Hmmm - always read the question as they say! I hadn't quite picked up that you were using dynamic dns. Not certain how you can get round that with W2K. You can try the following to listen on all :

ServerName mysite1.com
NameVirtualHost *
<VirtualHost *>
DocumentRoot /usr/local/apache/vhost1
ServerName vhost1.mysite1.com
</VirtualHost>

<VirtualHost *>
DocumentRoot /usr/local/apache/vhost2
ServerName vhost2.mysite1.com
</VirtualHost>

3) If it works - yes. Named based virtual hosting essentially allows you to run multiple websites on a single ip address. The target url in the header is used by apache to use one or other content directory as defined by the ServerName directive. By contrast, IP based vhosting gives the capability of hosting multiple sites that already have separate ip addresses on the same box.

Another apache solution is to use mod_rewrite . See --> .

Rgds
 
ouch that link you gave me was scary;)
Ok I will try to listen for all.. not confident that it will work though.

I'm still left with the option of running multiple instances of Apache on one machine right?

Any Ideas on how to set that up if I can't get this other to work the right way?

Thanks again
Betsy
 
OK,

I have tried messing around more with the Virtual Hosting features of Apache but still nothing. The Best I've been able to do is direct all incoming calls for site2 to site1.. then again if I don't mess with the conf file at all I get that too. So I'm not really getting very far;)

NameVirtualHost 172.16.16.1
<VirtualHost 172.16.16.1>
ServerName vhost1.mydomain.com
DocumentRoot /usr/local/apache/vhost1
ServerAlias vhost1
</VirtualHost>

I have tried implementing the above but I can't figure it out. Where it says 172.16.16.1 I have put the IP that is listed in my internic registration for the TZO server but that didn't work... also tried just putting in site2.com and that didn't work.. and all sorts of varieties of the above. also should I keep my site in a seperate folder if so by the above example what should the folder name be...

ARRRGH!! I think I'm losing it!!! heehee deep breaths
whew
Betsy

PS. Still up for trying to run mulitple instances of the server on my machine but still can't get it to work.. either the domain names point to one site or the other or none.. never both

HELP!!

 
Are you behind a firewall?
If so, check out my faq in this forum about virtualhosts behind a firewall.


Rninja

smlogo.gif

 
as of now I'm not technically behind a firewall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top