Книга: Fedora™ Unleashed, 2008 edition

Starting the Apache Server Manually

Starting the Apache Server Manually

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, httpd, recognizes several command-line options you can use to set some defaults, such as specifying where httpd reads its configuration directives. The Apache httpd 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're running the command as root):

# httpd -h
Usage: httpd [-D name] [-d directory] [-f file]
             [-C "directive"] [-c "directive"]
             [-k start|restart|graceful|stop]
             [-v] [-V] [-h] [-l] [-L] [-t]
Options:
 -D name           : define a name for use in <IfDefine name> directives
 -d directory      : specify an alternate initial ServerRoot
 -f file           : specify an alternate ServerConfigFile
 -C "directive"    : process directive before reading config files
 -c "directive"    : process directive after reading config files
 -e level          : show startup errors of level (see LogLevel)
 -E file           : log startup errors to file
 -v                : show version number
 -V                : show compile settings
 -h                : list available command-line options (this page)
 -l                : list compiled in modules
 -L                : list available configuration directives
 -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
 -t                : run syntax check for config files

Other options include listing Apache's static modules, or special, built-in independent parts of the server, along with options that can be used with the modules. These options are called configuration directives and are commands that control how a static module works. Note that Apache also includes nearly 50 dynamic modules, or software portions of the server that can be optionally loaded and used while the server is running.

The -t option is used to check your configuration files. It's a good idea to run this check before restarting your server, especially if you've made changes to your configuration files.

Such tests are important because a configuration file error can result in your server shut ting down when you try to restart it.

NOTE

When you build and install Apache from source and don't use Fedora's Apache RPM files, start the server manually from the command line as root (such as when testing). You do this for two reasons:

? The standalone server uses the default HTTP port (port 80), and only the super- user can bind to Internet ports that are lower than 1024.

? Only processes owned by root can change their UID and GID as specified by Apache's User and Group directives. If you start the server under another UID, it runs with the permissions of the user starting the process.

Note that although some of the following examples show how to start the server as root, you should do so only for testing after building and installing Apache. Fedora is set up to run web services as the apache user if you use Fedora RPM files to install Apache.

Оглавление книги


Генерация: 1.369. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз