Running httpd
After the Apache RPM is installed, use a tool such as chkconfig or tksysv to add httpd to the boot process to ensure that the server restarts when the system reboots. For example, to start httpd for runlevels 3 and 5 on a Red Hat system, enter the following chkconfig command:
[root]# chkconfig --level 35 httpd on
[root]# chkconfig --list httpd
httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
If your system doesn't have chkconfig, use another tool, such as tksysv. tksysv is used to run httpd at startup. Highlight httpd in the Available box, click Add, and then click Done in the next two dialog boxes to add it to the startup process.
If you don't install Apache from an RPM file, you won't have the /etc/init.d/ httpd startup script, and you will need to add Apache to the startup on your own.
You might be surprised to find that Apache is already configured and ready to run. Try this little test.
Listing: Starting and Checking httpd
[root]# httpd & [1] 2366 [root]# ps -Chttpd PID TTY TIME CMD 2367 ? 00:00:00 httpd 2368 ? 00:00:00 httpd 2369 ? 00:00:00 httpd 2370 ? 00:00:00 httpd 2371 ? 00:00:00 httpd 2372 ? 00:00:00 httpd 2373 ? 00:00:00 httpd 2374 ? 00:00:00 httpd 2375 ? 00:00:00 httpd [1]+ Done httpd
Start the httpd daemon, and use the process status (ps) command to check for all httpd processes running on the system. (This group of httpd processes is called the swarm; we will cover the swarm in more detail later.)
Next, launch a web browser and point it to the localhost. Not only is Apache installed and running, it is configured and responding with web data.
In this tutorial:
- Apache Web Server
- Installing Apache
- Running httpd
- Configuring the Apache Server
- The httpd.conf File
- Loading Dynamic Shared Objects
- Basic Server Directives
- Multi-Homed Server Configuration
- Defining Where Things Are Stored
- Creating a Fancy Index
- Defining File Types
- Managing Child Processes
- Performance Tuning Directives
- Caching Directives
- Defining Virtual Hosts
- Web Server Security
- The CGI and SSI Threat
- Server Options for Documents and Directories
- Directory-Level Configuration Controls
- Defining Access Controls
- Requiring User Authentication
- High-Performance User Authentication
- Configuring SSL
- Managing Your Web Server
- Monitoring Your Server
- Apache Logging
- Defining Log Formats
- Using Conditional Logging