Apache Web Server

Apache (httpd) is a web server, perhaps the most popular worldwide. Other web servers include IIS and nginx. This page will look at some of the configuration options for the Apache Web Server with a focus on Debian-based (especially Ubuntu) distributions.

Configuration Files

Apache utilizes text files for configuration. These text files contain directives (instructions). The configuration files for Apache are as follows:

  • apache2.conf – Global Settings (httpd.conf on many non-Debian servers).
  • conf-available – Available Configuration Files (replaces /etc/apache2.conf.d).
  • envvars – Environment variables.
  • mods-available¬†– Config files to load and configure modules.
  • mods-enabled – Symlinks to files in mods-available.
  • ports.conf – Defines TCP ports to listen on.
  • sites-available – Virtual Hosts exist here allowing multiple sites on a single physical server.
  • sites-enabled – Symlinks to files in sites-available.
  • magic – Defines how MIME types are determined using first few bytes of respective file.

Creating Virtual Hosts

  • Use sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mynewsite.conf to create new virtual host configuration file.
  • Use sudo a2ensite nameofsite to create a symlink in sites-enabled.
  • Use sudo service apache2 restart to restart Apache and ensure the config. updates are utilized.
  • To disabled a site use sudo a2dissite nameofsite.

Bibliography / Resources