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.
Locate your system's Apache configuration.
Common configuration directories include:
/etc/httpd/conf/
/etc/apache2/
/Applications/XAMPP/etc/
Within the configuration path, the main Apache configuration file is usually named one of the following:
httpd.conf
apache2.conf
A longer discussion on the possible locations and names of Apache configuration files is available here:
Set up an Apache virtual host (vhost) for your installation.
If your Apache configuration directory contains the directories sites-available
and sites-enabled
:
sites-available/swarm
.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
.
<VirtualHost *:80>
ServerName myswarm.host
ServerAlias myswarm
ErrorLog "/path/to/apache/logs/myswarm.error_log"
CustomLog "/path/to/apache/logs/myswarm.access_log" common
DocumentRoot "/path/to/swarm/public"
<Directory "/path/to/swarm/public">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Virtual host definition example for Apache 2.4:
<VirtualHost *:80>
ServerName myswarm.host
ServerAlias myswarm
ErrorLog "/path/to/apache/logs/myswarm.error_log"
CustomLog "/path/to/apache/logs/myswarm.access_log" common
DocumentRoot "/path/to/swarm/public"
<Directory "/path/to/swarm/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
myswarm.host
with the hostname for Swarm on your network. This may require adjusting the DNS configuration on your network.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.
/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
./path/to/swarm
with the path to the Swarm directory.Verify that the correct Apache modules are enabled.
In this step, x
is the version of PHP you are running, for example 5 or 7. For supported versions of PHP, see PHP.
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
phpx_module
and rewrite_module
in the output. If you see them, skip ahead to step 5.If the Apache utility a2enmod
is installed, use it to enable the PHP and Rewrite modules:
$ sudo a2enmod phpx
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 phpx
_module libexec/apache2/libphpx
.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
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
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: