-   Linux - Networking (
-   -   apache virtualhost (

jonfa 07-15-2002 09:29 PM

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

te_conway 07-16-2002 09:10 AM

Yes, this will work provided you setup the domain aliases with your dns service

Rashkae 07-16-2002 04:49 PM

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.

Syncrm 07-18-2002 12:31 PM

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. :-(

turnip 07-18-2002 04:50 PM


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.

xylum 08-12-2002 07:07 PM

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

All times are GMT -5. The time now is 05:29 AM.