Click to See Complete Forum and Search --> : apache / vhosts


the mitzman
11-21-2002, 02:35 PM
Hey guys, I just would like to know if what I'm doing is right before I go the next step.

I have 2 domains:
news.mycompany.com
www.anotherdomain.com

The computer here which is running apache has a single ip address. Now it is behind a firewall router (it's a MS ISA server) and all requests made to news.mycompany.com on port 80 are forwarded to my linux box right now. That's verified and it works.

Now I wanna setup a Vhost on this linux box to host 2 sites.
One is news.mycompany.com
and the second is www.anotherdomain.com

www.anotherdomain.com will point to the same ip as news does and the isa server will pass all traffic to www.anotherdomain.com to the linux box. This is how I imagine the vhosts should be configured on my box....

NameVirtualHost 192.168.100.50
<VirtualHost 192.168.100.50>
DocumentRoot /var/www/html
ServerName news.mycompany.com
</VirtualHost>

<VirtualHost 192.168.100.50>
DocumentRoot /home/anotherweb/html
ServerName www.anotherdomain.com
</VirtualHost>

Am I right on this? We came up with the idea to do a web-based newsletter for our company and I convinced the other tech guys (the programmers) that we needed to do this with a Linux box (plus I get to code the site in all PHP and mysql, yay!).
As far as I'm concerned, I've done the hardest part which was to setup samba (I've always had trouble with that but I got it today), use our PDC as authentication, and join the linux box to our Win2k domain.
As for the vhosts, am I missing something there or am I on the right track?

blizz
11-21-2002, 08:15 PM
Hi,

Looks okay to me.
Should work after you take care of your dns files too.

Regards ~

the mitzman
11-21-2002, 08:38 PM
Now what would I have to do with the DNS files? I mean I'm not running DNS On this machine? I've read through some how-to's but i'm still a little confused on this.

phlipant
11-22-2002, 05:17 AM
for some reason i had problems with www

ServerName www.philip-marsh.com

simply did not work. the following corrected the problem.




NameVirtualHost *

<VirtualHost *>
ServerName philip-marsh.com
ServerAlias philip-marsh.com *.philip-marsh.com
DocumentRoot "/var/www/html.com"
</VirtualHost>

<VirtualHost *>
ServerName philipmarsh.org
ServerAlias philipmarsh.org *.philipmarsh.org
DocumentRoot "/var/www/html.org"
</VirtualHost>

since your are behind a router, both domain names must be defined in your /etc/hosts file. even if you use the DNS resolver. your domain name server must list the static public ip of your router, while your /etc/hosts file must list the static private ip assigned to your computer by the router.

good luck.

the mitzman
11-22-2002, 08:15 AM
Ah ok. Thank you much. I'll have to give it a try at work today and see if it works. Sounds like it should!