Forum Moderators: phranque

Message Too Old, No Replies

help with apache virtual hosts!

         

Naibs3l

4:36 pm on Dec 4, 2007 (gmt 0)

10+ Year Member



I created a virtual host on apache so i can have multiple instances on a computer with a single IP. The only problem is whenever i need to add someone knew to a new instance that is create i have to restart apache. Which is not good because i need to have 100% uptime. so i wanted to create a separate file that virtual host looks to where i could add in the user and what instance to look to. Yet for some reason it is not working correctly. This is what i have so far...
***httpd.conf***
<VirtualHost *:80>
<IfModule mod_rewrite.c>
RewriteEngine on
# define the map file
RewriteMap vhost txt:conf/vhost.map
RewriteCond %{HTTP_host} ^(.*)$
RewriteCond ${vhost:%1} ^(.*)$
RewriteRule ^/(.*)$ %1$1
</IfModule>
</VirtualHost>

**vhost.map***
test.mycompany.com /index.html
test2.mycompany.com /index2.html

yet before when i had it all in the httpd file it worked perfectly, this is what i had before if it helps.
<VirtualHost test.mycompany.com>
RedirectMatch temp () /Main/index/preloginclassic.rdf
</VirtualHost>
<VirtualHost test.mycompany.com>
RedirectMatch temp () /Test/index/preloginclassic.rdf
</VirtualHost>

i think the problem maybe that its needing java to load the file i need. because the file its pointing to is technically not a physical file on the computer it is a virtual file.

gergoe

5:29 pm on Dec 4, 2007 (gmt 0)

10+ Year Member



Instead of trying to dig myself into this mapping thing, how about restarting the Apache with graceful restart [httpd.apache.org]? Doing a graceful restart tells the Apache to start up a new child, and the moment there are no request served by the old child, it will be terminated, that's your server's uptime will not be affected by the restart of the Apache, although the new configuration settings will be in effect after the graceful restart, same way after a full restart. On Windows you can do this by issuing the
bin/apache.exe -k restart
(or
apache.exe -k restart -n service_name
if running apache 1.3.x).