The apachectl command is an important command that you can use to administer the Apache Web server. However, to use this command, you may want to create the symbolic link that I created in the previous section. To view the options that can be used with this command, type the following command at the console:

#apachectl --help
usage: /usr/local/bin/apachectl (start|stop|restart|fullstatus|status|
graceful|configtest|help)

start      - start httpd
stop       - stop httpd
restart    - restart httpd if running by sending a SIGHUP or start if not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status     - dump a short status screen; requires lynx and mod_status enabled
graceful   - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help       - this screen

You can perform a syntax check for the Apache configuration using the configtest option with the apachectl command. The configtest option helps an Apache administrator check the syntax of the configuration file every time it is edited. The use of this option is as follows:

#apachectl configtest
Syntax OK

If you see the message Syntax OK after typing the preceding command, you can be assured that you have done everything correctly.

Now you are ready to start Apache. To do so, type the following command at the console:

#apachectl start
/usr/local/bin/apachectl start: httpd started

When executed, the preceding command starts the httpd service.

Tip If the httpd service is already running, using the restart option with the apachectl command will restart the httpd service.

Post By Editor (2,827 Posts)

Website: →

Connect