Swarm 2014.1: User Guide

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.

There is one common configuration that we recommend: configure your Apache server to use the prefork multi-processing module (MPM). It eliminates any potential problems due to lack of thread safety. prefork is the default MPM for Linux and OSX Apache installations.

Tip

For more information on Apache MPMs and configuration, see:

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


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

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

    • See Apache's full documentation for complete details:

    • Virtual host configuration example for Apache 2.2:

      <VirtualHost *:80>
          ServerName myswarm
          ServerAlias myswarm.machine.domain.com
          ErrorLog "/path/to/apache/logs/myswarm.error_log"
          CustomLog "/path/to/apache/logs/myswarm.access_log" common
          DocumentRoot "/path/to/vhosts/swarm/public"
          <Directory "/path/to/vhosts/swarm/public">
              AllowOverride All
              Order allow,deny
              Allow from all
          </Directory>
      </VirtualHost>
      
    • Virtual host configuration example for Apache 2.4:

      <VirtualHost *:80>
          ServerName myswarm
          ServerAlias myswarm.machine.domain.com
          ErrorLog "/path/to/apache/logs/myswarm.error_log"
          CustomLog "/path/to/apache/logs/myswarm.access_log" common
          DocumentRoot "/path/to/vhosts/swarm/public"
          <Directory "/path/to/vhosts/swarm/public">
              AllowOverride All
              Require all granted
          </Directory>
      </VirtualHost>
      

    Note

    Replace myswarm with the actual hostname you have configured for Swarm, and ensure that the DocumentRoot and Directory values above correspond to the public folder of the Swarm distribution you located previously.

  2. Verify that the correct Apache modules are enabled.

    • To query whether the PHP and Rewrite modules are active, use the apachectl utility to list all of the active modules (this may be named apache2ctl on your system):

      $ apachectl -t -D DUMP_MODULES
      
    • Simply look for php5_module and rewrite_module in the output. If you see them, skip ahead to step 3.

    • If your distribution ships with the Apache utility, a2enmod, use this to enable the PHP and Rewrite modules:

      $ sudo a2enmod php5 rewrite
      
    • Without the a2enmod utility, edit the Apache configuration file by hand. Locate your Apache configuration file for modules and either uncomment or add the following lines:

      LoadModule  php5_module     libexec/apache2/libphp5.so
      LoadModule  rewrite_module  libexec/apache2/mod_rewrite.so
      
    • Note that your Apache installation may have different paths for the location of its modules (the .so files).

  3. Restart your web server!

    • To ensure that the Apache configuration changes you made become active, restart the web server.

      $ sudo apachectl restart
      
    • Query Apache's active virtual hosts and modules to confirm your changes are in effect:

      $ apachectl -t -D DUMP_VHOSTS
      $ apachectl -t -D DUMP_MODULES
      
0 matching pages