Home > Articles

  • Print
  • + Share This
This chapter is from the book

Installing Apache on Unix

There are no practical restrictions on where you keep httpd. In particular, the executable doesn't assume that its configuration files or Web pages are stored in any particular subdirectories relative to its own location—as we will see, all that sort of thing is configurable.

The make utility you used to compile the httpd executable also provides an option for installing it:

make install 

Recall that when you originally ran the configure script, you used the --prefix option to specify a home directory for Apache. By default, the make install command will install the httpd executable in a subdirectory called bin under whatever you spec-ified as Apache's home directory.

Continuing the example above, we specified a home directory of "/apache". Therefore, the "make install" command will install httpd in:

/apache/bin/httpd 

Higher Security Installation

The default location is not a bad place to keep httpd while you're playing around and getting the configuration settings just the way you want. Once you're ready to put the server on a publicly accessible network, it's safer to put the executable in a more secured location of the directory tree—perhaps /sbin. Continuing the example above:

mv /apache/bin/httpd /sbin/httpd 

Also, regardless of where you install httpd, make sure that the new executable has secure ownership and permissions:

chown 0 /sbin/httpd
chgrp 0 /sbin/httpd
chmod 511 /sbin/httpd

Once you've moved your server out of the default location, you will need to edit your control script and change the setting of the httpd variable to the new location of your executable.

vi bin/apachectl 

Once in the apachectl script, change the htppd variable as shown below:

httpd=/the/new/location 
  • + Share This
  • 🔖 Save To Your Account