Web Server Configuration

(this page is still incomplete, but better than nothing)

We are using Apache's httpd web server, version 2.210, on all of our servers. It serves HTML and PHP pages, and also acts as a proxy to serve JSP pages from Apache Tomcat running on the same server on port 8080.

We build this from source code, as described on the Web Build page, and it's installed in /usr/local/apache and subdirectories.

Configuration Files

The configuration files are under /usr/local/apache/conf, with archived versions stored in SVN in trunk/config/usr/local/apache/... to match the directory layout used in service. The main files are:
  • httpd.conf - main configuration file. This also loads selected elements from
  • extra/ - additions from Apache to turn on things like user directories and SSL. The main files we have modified are
    • httpd-ssl.conf - configuration for Secure Socket Layer (SSL) for https (encryption).
  • local.d/ - additional configuration for various components that we have set up, divided into separate files for convenience . The httpd.conf file has code at the end which loads all *.conf files from local.d/. They are loaded in alphanumeric order, so if you care about the order, then prefix the filename with a digit.
    • 00-Server.conf contains server-specific information, like the name
    • ... (to be fleshed in later)


The main configuration file is httpd.conf in the directory /usr/local/apache/conf (which is where all other configuration is kept too, either in that directory or in subdirectories). You need to edit this file to adjust the configuration for such things as user and group to run under, DocumentRoot and log directories, etc. On Ubuntu/Debian systems (like www13) the user and group should be "www-data". (On Fedora/RedHat systems it will be "apache".)

You can't turn on SSL encryption support unless you have server certificates in place.

extra/ and local.d/ subdirectories

The main configuration will read from files in the extras/ subdirectory (if you enable these in httpd.conf). You should also create a local.d/ subdirectory for our own server configuration files Then when you edit httpd.conf add at the end the following:
# Load local config files for virtual servers or specific areas
Include conf/local.d/*.conf
This causes all files in that subdirectory with names ending in ".conf" to be loaded (in alphanumeric order). Files with other names are ignored.

init script

When the system boots or reboots it will run a script in /etc/init.d to start or stop the web server daemon. Long term maintenance will be easier if you put this in the directory /usr/local/apache/init.d (you may need to create it) and then link to it from /etc/init.d. The script is also in the CVS directory src/httpd mentioned in the previous section.

The first time you install this script you need to run `update-rc.d` on Ubuntu/Debian (as on www13) to install the proper links to the script from the /etc/rc.? directories for different run levels. (If on Fedora/RedHat use `chkconfig httpd on`.)

Log files

Log files can either go to /var/log/httpd or /usr/local/apache/logs. This is configured in the httpd.conf file. Be sure the permissions are set to that the web-server user can write to the log files.

-- Main.EricMyers - 19 May 2009
Topic revision: r6 - 2013-08-07, forero
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback