Starting and Stopping Apache

At this point, you have installed your Apache server with its default configuration. Ubuntu provides a default home page named index.html as a test under the /var/www/ directory. The proper way to run Apache is to set system initialization to have the server run after booting, network configuration, and any firewall configuration. See Chapter 15, "Automating Tasks," for more information about how Ubuntu boots.

It is time to start it up for the first time. The following sections show how to either start and stop Apache or configure Ubuntu to start or not start Apache when booting.

You can start Apache from the command line of a text-based console or X terminal window, and you must have root permission to do so. The server daemon, apache2, recognizes several command-line options you can use to set some defaults, such as specifying where apache2 reads its configuration directives. The Apache apache2 executable also understands other options that enable you to selectively use parts of its configuration file, specify a different location of the actual server and supporting files, use a different configuration file (perhaps for testing), and save startup errors to a specific log. The -v option causes Apache to print its development version and quit. The -v option shows all the settings that were in effect when the server was compiled.

The -h option prints the following usage information for the server (assuming that you are running the command through sudo):

sudo httpd -h

Was this article helpful?

0 0

Post a comment