gem version

Working with the Apache configuration file

Relevant selection for this article:


If you want to install Passenger in its Apache integration mode then you will reach a point where you have to edit Apache the configuration file. This page provides information for those who are not familiar with how the Apache configuration file and its related directories are organized.

The location of the Apache configuration file

On most systems if you installed Apache with a package manager, or it came preinstalled, the Apache configuration file is located in one of these locations:

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf

If you installed Apache from source it is likely located in /usr/local or /opt, though the config files may have been moved to /etc as usual. Check your build script for more details.

Furthermore On macOS Server ≥ 10.8 Mountain Lion, the location of the Apache configuration file varies. Some paths are listed below, please refer to the macOS Server documentation for complete information.

Not using websites/webservices default (/etc/apache2/httpd.conf)
macOS Server 4 webservices /Library/Server/Web/Config/apache2/httpd_server_app.conf
macOS Server 5 websites /Library/Server/Web/Config/apache2/server-httpd.conf

mods-enabled and sites-enabled

To allow better organization, many operating systems and Apache distributions also read configuration files in the conf.d, mods-enabled and sites-enabled subdirectories.

mods-enabled contains symlinks to files in mods-available. This latter subdirectory contains config files for all available modules, while mods-enabled contains only a subset, namely the modules that should actually be enabled. The symlinks are created using the a2enmod tool. *.load files contain LoadModule directives, while *.conf files contain all other configuration directives.

Storing Passenger configuration snippets

If you can, you should use mods-enabled/mods-available to store Passenger configuration. Assuming that your Apache configuration directory is /etc/apache2:

  • Create /etc/apache2/mods-available/passenger.load and paste the LoadModule ... directive that passenger-install-apache2-module outputs.
  • Create /etc/apache2/mods-available/passenger.conf and paste the PassengerRoot and other Passenger options.
  • Enable by running sudo a2enmod passenger.

If the mods-enabled mechanism is not available then you can paste configuration snippets into httpd.conf or apache2.conf directly.

See also

light mode dark mode
Passenger 6 Passenger 6