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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cant get virtualhost conf properly

Status
Not open for further replies.

gwu

MIS
Dec 18, 2002
239
US
I cant seem to get virtual hosts working. i have two IP address' on the box:
10.0.0.98
10.0.0.222

For some reason when i try to go to the site using the browser, they both go to the same index.html in "/var/
In the "global environment" section:
*******************
BindAddress *
Listen *:80
*******************


In the "main" section:
*******************
BindAddress 10.0.0.98
Listen *:80
DocumentRoot /var/*******************

"virtual" section:
*********************
<VirtualHost 10.0.0.222>
DocumentRoot /web/otherFolder
ServerName localhost.localdomain
<Directory &quot;/web/otherFolder&quot;>
</Directory>
</VirtualHost>
*********************


when I type:
>httpd -S
I get:
10.0.0.222 localhost.localdomain(/yada/yada:1456)

what am i doin wong??


thanks
 
Hi,

If you want: 2 IP's on one Website make a line like this:

Listen 12.34.56.78:80 12.35.57.79:80 # or:
BindAddress 12.34.56.78 12.35.57.79

If you want 2 IP's and two or more Websites make your configureation like this:

NameVirtualHost 12.34.56.78:80
NameVirtualHost 12.35.57.79:80

# This if you want to listen on both IP's fot this Site
<VirtualHost 12.34.56.78:80 12.35.57.79:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /path/to/www
ServerName domain1.com
ServerAlias ErrorLog /path/to/error_log
CustomLog /path/to/logs/access_log combined
</VirtualHost>

# This is for IP 1
<VirtualHost 12.34.56.78:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /path/to/www
ServerName your.domain1.com
ErrorLog /path/to/error_log
CustomLog /path/to/logs/access_log combined
</VirtualHost>

# This is for IP 2
<VirtualHost 12.35.57.79:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /path/to/www
ServerName your.domain2.com
ErrorLog /path/to/error_log
CustomLog /path/to/logs/access_log combined
</VirtualHost>


# this is for your-other-domain on one of the IP's
<VirtualHost 12.35.57.79:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /path/to/www
ServerName your.your-other-domain.com
ErrorLog /path/to/error_log
CustomLog /path/to/logs/access_log combined
</VirtualHost>

You can make like that as many Virtualhosts you want on either IP, also SubDomains

Good Luck!
Blizz
 
i think i understand... but it still is not working correctly after adding your suggestions.
 
You can have as many vhosts as you want using one ip. I'm wondering why you want to use two ip addresses? You can set up apache to listen to all ip addresses but the device that is connected to the internet is the only one that traffic will come in on unless you can direct requests for a particular domain to go to each internal ip. You would need to setup bind for local dns to do that.
 
i have my firewall ,linux :), forwarding each external ip address to internal ip address' on an internal webserver. so my firewall has, for example, two extra ip address' set on its external interface card 12.35.57.79 and 12.35.57.78. if someone types in (which resolves to 12.35.57.79 for example) it will go to the firewall and the firewall will forward it to port 80 on the web server at 10.0.0.79 . if someone types in 12.35.57.78 the firewall will forward it to 10.0.0.78 on the same web server. so i need to set up two virtual hosts on the webserver,10.0.0.78 and 10.0.0.79.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top