Starting on System Startup
If you are going to run Apache on a production systemthat is, if you want people to be able to look at your Web site all the timethen you need to make sure that Apache starts up when you reboot your computer.
This is accomplished a variety of ways on different systems, but they are all typically just a small variation on the same theme.
In /etc/rc.d you will find a collection of scripts, typically with filenames starting with rc. (such as rc.inet1, rc.firewall, and rc.local) which run when your system starts up. The exact layout of this directory varies. Sometimes these scripts are located in subdirectories. Sometimes there are several subdirectories, corresponding to the various runlevels2, containing the scripts, or symlinks to the scripts, and sometimes the scripts are all directly in /etc/rc.d.3
When you know how your system does things, you should create a startup script (called rc.httpd, for example) which contains a call to either apachectl or httpd, as you prefer, telling it to start your server. Alternately, many systems have a script called rc.local, which is specifically for you to put in your customizations to the startup process; this enables you to keep all your startup alterations in the same place.
So, for example, you can add the following line to either your rc.local, or to a separate file called rc.httpd:
Or, if you want to start Apache with a configuration file other than the one in the default location, you could use the following line instead:
/usr/local/httpd/bin/httpd -f /etc/httpd/host2.conf