Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have mentioned here apache web server because i am using that one.

share|improve this question

migrated from stackoverflow.com Dec 8 '09 at 14:44

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

up vote 12 down vote accepted

I just had a look at this page but not sure how relevant its to yours.

Dynamically Configured Mass Virtual Hosting

The basic idea is to replace all of the static configurations with a mechanism that works them out dynamically. This has a number of advantages:

  1. Your configuration file is smaller, so Apache starts more quickly and uses less memory.
  2. Adding virtual hosts is simply a matter of creating the appropriate directories in the filesystem and entries in the DNS - you don't need to reconfigure or restart Apache.

UPDATE

Adding Virtual Hosts without Restarting Apache

It turned out that the solution was to use VirtualDocumentRoot instead of just the plain old DocumentRoot setting for a single virtual host. This allowed specifying the $0 variable as part of the value. So we ended up being able to have “VirtualDocumentRoot /somedir/$1″.

share|improve this answer
add comment

Make any changes to your VirtualHosts, then do

apache2ctl configtest

To make sure there aren't any outstanding syntax errors, and run this:

apache2ctl graceful

or

/etc/init.d/apache2 graceful

The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.

Basically any existing connections stay intact, so it's not the same as a full restart - this is how I usually do this on production servers with dozens of sites.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.