Create a gist now

Instantly share code, notes, and snippets.

Minimal httpd.conf for running apache in the foreground for local php development.
#
# Minimal httpd.conf for running apache in the foreground for local php
# development.
#
# Setup:
# 1. Place this file in the root of your project.
# 2. Make sure the ./tmp directory exists (for the pid and lock files).
# 3. Update the DocumentRoot and Directory directives with the relative path to
# your project's document root.
#
# Usage:
# httpd -d . -f httpd.conf -DFOREGROUND
#
# Relative file paths in this file are relative to the server root, which is
# assumed to be set from the command line option, as in the about usage.
#
ServerName localhost
Listen 8080
PidFile tmp/httpd.pid
LockFile tmp/accept.lock
#
# Optional Modules
#
# Provides allow, deny and order directives.
LoadModule authz_host_module /usr/libexec/apache2/mod_authz_host.so
# Provides DirectoryIndex directive.
LoadModule dir_module /usr/libexec/apache2/mod_dir.so
# Provides SetEnv directive.
LoadModule env_module /usr/libexec/apache2/mod_env.so
# Provides automatic mime content type headers.
LoadModule mime_module /usr/libexec/apache2/mod_mime.so
# Provides CustomLog and LogFormat directives.
LoadModule log_config_module /usr/libexec/apache2/mod_log_config.so
# Allow rewrite rules in .htaccess files.
LoadModule rewrite_module /usr/libexec/apache2/mod_rewrite.so
# Using homebrew php53. Change as necessary.
LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so
#
# Logs are piped to `cat` which prints to STDOUT.
#
LogLevel info
ErrorLog "|cat"
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "|cat" common
#
# Since this is intended for local environments, the single document root is
# highly permissive.
#
DocumentRoot "build"
<Directory "build">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
#
# Basic PHP handling.
#
AddType application/x-httpd-php .php
DirectoryIndex index.html index.php
#
# Provide applications with a hook to detect when running locally.
#
SetEnv LOCAL_SERVER true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment