Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 07-15-2002, 08:29 PM   #1
Registered: Mar 2001
Location: FL
Posts: 257

Rep: Reputation: 30
apache virtualhost

Hi All,

I have a Redhat 7.2 box with a DSL connection. The ISP dynamically assigns the IP's so the IP changes often. Right now I use for DNS service to run my website ( This runs flawlessly, but I want to set up several other websites on the same box, but I am unsure of the parameters required by httpd.conf. Will something like the following work:

<VirtualHost> # is the IP of the Redhat box with apache running
DocumentRoot "/var/www/html"

DocumentRoot "/var/www/html/someother"

I already have specified in the beginning of httpd.conf so does this even need to be in the VirtualHost section? What am I doing wrong? Is this even possible?

Jon Faranda
Old 07-16-2002, 08:10 AM   #2
Registered: Apr 2001
Location: MA
Distribution: redhat 7.2
Posts: 182

Rep: Reputation: 30
Yes, this will work provided you setup the domain aliases with your dns service
Old 07-16-2002, 03:49 PM   #3
Registered: May 2002
Distribution: Slackware
Posts: 125

Rep: Reputation: 15
192.168.*.* is an internal address, unless you you have a firewall port forwading port 80 to your Http Server, people will be unable to accesss your web server from over the internet.

Try this:

NameVirtualhost *

<virtualhost *>

repeast as needed.

That should configure Apache to use all your active IP addresses as as Name based virtual hosts.
Old 07-18-2002, 11:31 AM   #4
Registered: Aug 2001
Location: Lansing, Michigan
Distribution: slackware8+
Posts: 472

Rep: Reputation: 30
i have a similar configuration in terms of domains and apache. however, i have never been able to get virtual hosts working correctly.

my network setup is as follows: my domain name is, which uses the DNS servers of to point to my IP. however, my cable company blocks port 80, which means that is forwarded to from this is necessary since all requests to port 80 are blocked.

i'm running a firewall with IP MASQ and iptables which forwards all port 81 requests to the machine which apache is residing on. my virtual hosts appear as follows:

NameVirtualHost *

<VirtualHost *>
DocumentRoot /usr/local/apache/htdocs
ErrorLog logs/error_log
CustomLog logs/access_log custom

DocumentRoot /usr/local/apache/htdocs
ErrorLog logs/internal/error_log
CustomLog logs/internal/access_log custom

the weird thing is that the second virtual host works perfectly (as it keeps separate log files for my internal clients. but if i change the first VH to some non-existant docroot, nothing happens and everything goes to the default docroot.

does anyone have any suggestions at all? i've been pulling my hair out over this for some time now and am still unable to find a solution. :-(
Old 07-18-2002, 03:50 PM   #5
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15

here is the easiest way to do v-hosts
setup one docroot, nuke the v-host entry out of httpd.conf
make your new v-host a sub dir in doc root

then in doc root make a .htaccess file

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST}
RewriteCond %{REQUEST_URI} !path/to/dir/
RewriteRule ^(.*)$ path/to/dir/$1 [L]

put one site in doc root, the other in path/to/dir and you're good to go.
Old 08-12-2002, 06:07 PM   #6
LQ Newbie
Registered: Aug 2002
Posts: 13

Rep: Reputation: 0
after i modify my vhost file is there a change i need to make in the http.conf file? ot get vhost to work?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
apache + add a VirtualHost linuxtesting2 Linux - Newbie 2 09-03-2005 03:21 AM
Apache -VirtualHost davidhk Debian 7 08-19-2005 12:33 PM
VirtualHost Apache 2 Problem Chris_K1 Linux - Networking 0 01-25-2005 10:00 AM
Apache & VirtualHost nIMBVS Slackware 2 10-27-2004 03:01 PM
Help with Apache <VirtualHost> please. smakkythecamel Linux - Networking 2 06-12-2003 07:15 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration