Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To avoid Apache restart, Dynamically Configured Mass Virtual Hosting is used. But, --in this case-- Apache takes vhost configurations from directory pattern. So, I am not free to choose DocumentRoot directory which doesn't match with selected pattern. For example, if I have set pattern like ...user/www/domain/subdomain, I will have to create directories like the pattern to add a domain/subdomain as vhost.

But, cPanel allows its users to freely choose DocumentRoot for add-on domains & subdomains they add. And, it doesn't restart Apache each time a change is made. Changes are instantaneous too.

What does cPanel exactly do to Apache configurations?
I've guessed that it has to do with the same Dynamically Configured Mass Virtual Hosting, but I've given up after few days of brainstorming. Can you please help?

share|improve this question
If I had to guess I'd say it's sending Apache a USR1 signal, to gracefully restart with no loss of service. I don't have an install with which to verify, but you should be able to confirm by checking the Apache logs. – Shane Madden Feb 11 '12 at 20:39
@ShaneMadden You are saying to add vhosts in httpd.conf or httpd-vhosts.conf and then restart Apache with USR1 signal. Do you really think it would work? I think, service will have to lose its state to read configuration file.. think if it has thousands of vhosts (making file big). – Evil Angel Feb 11 '12 at 21:16
A graceful restart can take as long as it needs to without disrupting service at all. Again, I'm not certain that this is how it's doing it, but you can easily confirm by checking the log. – Shane Madden Feb 11 '12 at 22:24
up vote 0 down vote accepted

Finally, I have found solution. To avoid restart, I don't need Dynamically Configured Mass Virtual Hosting (its always better to think in simple way, first). Apache provides apachectl for this task. On Debian 6, its binary was /usr/sbin/apachectl with default apt-get based installation. It may vary from system-to-system. If you compile & install Apache from its source, it should be in your control.
Assuming location of apachectl binary is in your PATH variable, this command does what I need:

apachectl graceful

It restarts web server without terminating current connections to server. Means, its just like reloading configuration files without restart. I don't know how cPanel exactly does it, but it works.

share|improve this answer

Your Answer


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.