At the command-line prompt for your server, issue the apachectl graceful
command, or the
appropriate restart command for your web server.
Restarting your web server has come up in several of the topics covered in this chapter. When you modify the configuration file for Apache, you have to restart it for any changes to take effect.
Basic webhosting accounts usually share Apache server processes with other web sites, so if that's the case with your web site, your provider may not want or allow you to restart Apache. Web designers with higher priced virtual server accounts, or accounts running on a dedicated server, have Apache all to themselves and usually can issue the commands for stopping and starting it as needed.
Later versions for Apache install with a control script called
apachectl
. With it, you can start,
stop, and restart the HTTP daemon on your dedicated server or "virtual
server" account.
- Finding the script
You should be able to use
apachectl
at the command-line prompt to your web server by typing its name followed by a space andstop, start
, orgraceful
. If that does not work, you will have to specify the full path to the script. To locate the script on your server, use one of these commands:find / -name apachectl
or:
which apachectl
- Stopping and starting Apache
The results of the commands
apachectl stop
andapachectl start
are self-evident.- Gracefully restarting Apache
A better way to restart Apache after a change to the configuration file is with the
graceful
argument toapachectl
. In this case, Apache leaves current connections to browsers open and starts applying the changed settings to new connections.
The Apache Software Foundation web site has more information
about stopping and starting the Apache web server on the manual page
for apachectl
at http://httpd.apache.org/docs/programs/apachectl.html
and a guide to restarting Apache at http://httpd.apache.org/docs/stopping.html.
Get Web Site Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.