Apache Interview Cheat Sheet

I put this together for a friend as a sort of 30-second overview of things I think you should know for a job interview. Obviously, if you're going for a position as a full-time Apache admin you'll need to know more but if Apache is just one of many requirements then I think this is helpful.

Lingo to know:

httpd.conf - configuration file read on startup of Apache
modules - provide additional functionality to Apache such as SSL, PHP, etc.
directives - These are the individual configuration options in the httpd.conf (List at bottom)
DSO - Dynamic Shared Objects are the new way Apache handles modules allowing them to be loaded after install.
Host headers - When two sites are hosted on the same server with the same IP, host headers allow Apache to know which site to serve. Let's say that one server hosts cnn and espn. You try to access espn and your browser sends a host header to Apache and it knows you were looking for espn not cnn even though they are the same IP.

Questions:

How do I add a module? Use the LoadModule directive in httpd.conf and place the actual module file in the /modules directory. Modules will typically have a .so extension.

What is a virtual host? When you want to host multiple web sites on a single Apache instance, you need virtual hosts.

Name the difference between name based and IP based virtual hosts? Name based uses host headers and can server multiple sites out on one IP address. IP based means you have to have separate IPs for each site. Host headers is preferred because you save IPs. The only reason not to use it is some (very) old browsers don't support host headers.

What are some basic configure options when building Apache? When building Apache from source you must use the configure statement to give build options like where it should install and what extra support it should have. You would run configure --prefix=/usr/local/apache --enable-ssl --enable-so. This would build Apache to install in /usr/local/apache with ssl support and so support for adding on modules with DSO.

What versions of Apache have you worked with? 1.3 is an older version but still somewhat in use. 2.0 is now the standard and obviously there are smaller revisions along the way. 2.2 is the newest and is still not heavily implemented.

How do I stop and start Apache? From the bin directory, apachectl (stop|start|startssl)
./apachectl graceful will recycle the server, re-reading the httpd.conf, once there are no active connections.

Know these options to apachectl: apachectl -t will check the syntax of the httpd.conf. This is a good idea once you have made changes to httpd.conf on a live Apache server. When you restart the server it will re-read this file and if there are errors it won't restart. If you run apachectl -t it will tell you if thee are errors before trying to restart.

apachectl -v will tell you the version of Apache

Know the specified options below:

Listen 127.0.0.1:80 - tells the server what IP addresses and ports to listen on.
ServerName www.slugnuts.com:80 - gives the server a DNS-based name
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" - tells where the actual content is placed. htdocs is default.
NameVirtualHost *:80 - tells Apache you want to use name-based virtual hosts.

Know the main directory structure:

/bin - binary files for starting and stopping Apache
/modules - location where you put add-on modules such as the Weblogic plug-in
/logs - log files: error_log, access_log
/htdocs - location of actual web content