configuration.

In addition to the previous options, the httpd script also offers these features:

help — Prints a list of valid options to the httpd script (which are passed onto the server as if called from the command line).

configtest — A simple test of the server's configuration, which reports Status OK if the setup is correct. You can also use httpd's -t option to perform the same test, like this:

# httpd -t

fullstatus — Displays a verbose status report.

graceful — The same as the restart parameter, except that the configtest option is used first and open connections are not aborted.

TIP

Use the reload option if you're making many changes to the various server configuration files. This saves time when you're stopping and starting the server by having the system simply reread the configuration files.

Controlling Apache with Fedora's service Command

Instead of directly calling the /etc/rc.d/init.d/httpd script, you can use Red Hat's service command to start, stop, and restart Apache. The service command is used with the name of a service (listed under /etc/rc.d/init.d) and an optional keyword:

# service <name_of_script> <option>

For example, you can use service with httpd and any option discussed in the previous section, like so:

# service httpd restart

This restarts Apache if it's running or starts the server if it isn't running.

Controlling Apache with Fedora's chkconfig Command

The chkconfig command provides a command-line-based interface to Fedora's service scripts. The command can be used to list and control which software services are started, restarted, and stopped for a specific system state (such as when booting up, restarting, or shutting down) and runlevel (such as single- user mode, networking with multitasking, or graphical login with X).

For example, to view your system's current settings, take a look at Fedora's default runlevel as defined in the system initialization table /etc/inittab using the grep command:

# grep id: /etc/inittab

id:3:initdefault:

This example shows that this Fedora system boots to a text-based login without running X11. You can then use the chkconfig command to look at the behavior of Apache for that runlevel:

# chkconfig --list | grep httpd

httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Here you can see that Apache is turned off for runlevels 3 and 5 (the only two practical runlevels in a default Fedora system, although you could create a custom runlevel 4 for Apache). Use --level, httpd, and the control keyword on to set Apache to automatically start when booting to runlevel 3:

# chkconfig --level 3 httpd on

You can then again use chkconfig to verify this setting:

# chkconfig --list | grep httpd

httpd 0:off 1:off 2:off 3:on 4:off 5:off 6:off

To have Apache also start when your system is booted to a graphical login, again use level, httpd, and the control keyword on, but this time, specify runlevel 5 like so:

# chkconfig --level 5 httpd on

Again, to verify your system settings, use the following:

# chkconfig --list | grep httpd

httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off

Use the off keyword to stop Apache from starting at a particular runlevel.

Graphic Interface Configuration of Apache

Some of Apache's basic behavior can be configured with Red Hat's system-config-httpd, a GUI tool for the X Window System. This is an easy way to configure settings, such as Apache's user and group name, the location of PID and process lock files, or performance settings (such as the maximum number of connections), without manually editing configuration files.

CAUTION

If you use system-config-httpd, you shouldn't try to manually edit the httpd.conf file. Manual changes are overwritten by the GUI client if you again use system- config-httpd!

Launch this client by using your X desktop panel's Server Settings' HTTP Server menu item or from the command line of an X terminal window, like this:

$ system-config-httpd &

After you press Enter, you're asked to type the root password. You then see the main client window shown in Figure 17.1.

FIGURE 17.1 The system-config-httpd main dialog box provides access to basic configuration of the Apache web server.

In the Main tab, you can set the server name, indicate where to send email addressed to the webmaster, and set the port that Apache uses. If you want, you can also configure specific virtual hosts to listen on different ports.

Configuring Virtual Host Properties

In the Virtual Hosts tab, you can configure the properties of each virtual host. The Name list box contains a list of all virtual hosts operating in Apache. Edit a virtual host by opening the Virtual Hosts Properties dialog box, shown in Figure 17.2. You do this by highlighting the name of a virtual host in the Name list box of the Virtual Hosts

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату