Apache configuration

The configuration of the Apache HTTP Server (Apache) can vary between OS distributions; see the documentation specific to your installation of Apache. For example, on Mac OS X, you may have to enable Web Sharing within the Sharing control panel in System Preferences.

  1. Locate your system's Apache configuration.

    Common configuration directories include:

    Within the configuration path, the main Apache configuration file is usually named one of the following:

    Note

    A longer discussion on the possible locations and names of Apache configuration files is available here:

    https://wiki.apache.org/httpd/DistrosDefaultLayout

  2. Set up an Apache virtual host (vhost) for your installation.

    If your Apache configuration directory contains the directories sites-available and sites-enabled:

    1. Copy the appropriate virtual host definition below into the file sites-available/swarm.
    2. Enable the Swarm virtual host definition.

      $ sudo a2ensite swarm

    Otherwise, copy the appropriate virtual host definition below into the bottom of the main Apache configuration file, httpd.conf or apache2.conf.

    Note

    See Apache's virtual host documentation for details:

    https://httpd.apache.org/docs/2.2/vhosts/

    https://httpd.apache.org/docs/2.4/vhosts/

  3. Customize the virtual host definition.
    1. Replace myswarm.host with the hostname for Swarm on your network. This may require adjusting the DNS configuration on your network.
    2. Replace myswarm with the name of the subdomain hosting Swarm. Many administrators choose swarm.

      Note the string myswarm in the log file paths: this should match the subdomain name and prefix for the log files, to help coordinate the active host with the log files for that host. Doing this is particularly useful when your Apache server hosts multiple instances of Swarm.

    3. Replace /path/to/apache/logs with the path where your Apache stores its log files. Apache's log files are typically named access_log and error_log.
    4. Replace /path/to/swarm with the path to the Swarm directory.
  4. Verify that the correct Apache modules are enabled.

    Note

    In this step, x is the version of PHP you are running, for example 5 or 7. For supported versions of PHP, see PHP.

  5. Restart your web server.

    Important

    Apache must be configured to use the prefork MPMMulti-Processing Module, a component of the Apache web server that is responsible for binding to network ports, accepting requests, and dispatch operations to handle the request. because P4PHP does not support threaded operation.

    The prefork MPM is the default for Linux and OSX Apache installations, so you may not have to do anything.

    For more information on Apache MPMs and configuration, see:

    https://httpd.apache.org/docs/2.2/mpm.html

    https://httpd.apache.org/docs/2.4/mpm.html

  6. Configure PHP, see PHP configuration.