Download Web Server Management: Running Apache 2 on Red Hat Linux
Transcript
Chapter 3. Getting started Listen 80 User apache Group apache ServerRoot /etc/httpd Options None Figure 3-8. httpd.conf: Minimal version Syntax summary: Getting launched Listen This specifies the network interface the server should listen on. If only a port is specified then it will listen on every active network address. (Typically the system’s own network address and the loopback address.) User This specifies the system user ID that the server process should run as. This user was created by the Red Hat Linux Apache package. Group This specifies the system group ID that the server process should run as. This group was created by the Red Hat Linux Apache package. ServerRoot All unqualified filenames in the configuration file will be resolved with respect to this directory except for the actual web pages which will be handled by a different command. Options This command sets various parameters in the configuration. We will meet these through the course as we turn them on. And if we start the web server now, with this five line configuration file, it launches just fine and stays running. # /etc/init.d/httpd start Starting httpd: [ OK ] # tail -1 /var/log/httpd/error_log [Mon Mar 17 18:02:56 2003] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming norma # ps -ef | grep httpd root 9344 1 0 18:02 ? 00:00:00 /usr/sbin/httpd apache 9345 9344 0 18:02 ? 00:00:00 /usr/sbin/httpd apache 9346 9344 0 18:02 ? 00:00:00 /usr/sbin/httpd apache 9349 9344 0 18:02 ? 00:00:00 /usr/sbin/httpd apache 9350 9344 0 18:02 ? 00:00:00 /usr/sbin/httpd apache 9351 9344 0 18:02 ? 00:00:00 /usr/sbin/httpd root 9357 8826 0 18:05 pts/3 00:00:00 grep httpd Figure 3-9. Successful launch But, as the figure shows, it’s not a single daemon that gets launched. There are six of them. The first column of the ps output gives the owner of the process and the second gives the process ID or PID. One of the server processes is owned by user root and the others by user apache. That root-owned process is the parent process of all the other processes. What happens is that the startup script that we manually invoked launched the parent, root-owned process (PID 9344). It in turn launched five child processes owned by apache (PIDs 9345–9351). Why? Well, the idea is that the parent process does not service any request at all. Its sole purpose is to keep an eye on the child processes. If one of them dies for any 17