Netmar User's Guide Netmar.com
Contact Netmar
Order Webhosting

Linux control panel

   
Netmar User's Guide  


Apache - Control commands

Most of apache's simple functionality can be controlled with the apachectl command.
/usr/sbin/apachectl

You can see the available commands for apache by typing:
apachectl help

Starting Apache:
In order to start apache, if it is not running, you can type:
apachectl start
Other commands (restart, graceful; discussed in a moment) will start apache if it is not running. Before starting apache, it is a good idea to test your config file.

Config file sanity check:
Before doing anything else with the apachectl command, I have tried to get in the habit of testing the configuration. To do this, simply type:
apachectl configtest
It will output any errors and warnings it may have. Note that apache will start with warnings, but not with errors. If it says "Syntax OK", it may not be what you want exactly, but it's not broken and it will start.

Restarting Apache:
The apachectl restart command will restart apache, however, there is a better way to restart. If you type:
apachectl graceful
then apache will "gracefully restart", meaning that it will allow all of it's current processes to continue doing their work, but it will kill off and start a new master process, and all new requests will be handeled by the new process. All new child processes will be spawned under the new master process.
When you use either restart or graceful, the config file will be reloaded with any new options you have enabled or virtual servers you have configured. Note that if you use apachectl stop / apachectl start to restart apache, and you use an SSL certificate that requires a PEM passphrase to be input, it will ask you for the passphrase.

Stopping Apache:
Simple enough, just type:
apachectl stop

Getting a status report:
In order to get a simple status report, you can type
apachectl status
Note that you must have lynx installed and mod_status enabled in your httpd.conf file. If you don't have lynx installed (RedHat machines come with links not lynx), you can just symlink it with these commands:
cd /usr/bin
ln -s links lynx



Quick Start Guide :: Visit the old Guide :: Dedicated Server Guide

All content © 2002,2003 NetMar, Inc.