Skip to content

Instantly share code, notes, and snippets.

@carwin
Created September 19, 2012 16:47
Show Gist options
  • Save carwin/3750719 to your computer and use it in GitHub Desktop.
Save carwin/3750719 to your computer and use it in GitHub Desktop.
Lighttpd Configuration for Drupal
##
## Variables
##
var.log_root = "/var/log/lighttpd"
var.server_root = "/var/www"
var.state_dir = "/var/run"
var.home_dir = "/var/lib/lighttpd"
var.conf_dir = "/etc/lighttpd"
var.vhosts_dir = server_root + "/vhosts"
##
#################################################
#################################################
##
## Load modules.
include "modules.conf"
##
#################################################
#################################################
##
## Basic Configuration
## --------------------
##
server.port = 80
server.bind = "localhost"
server.username = "http"
server.groupname = "http"
server.document-root = vhosts_dir + "/mycomp.local/httpdocs"
server.pid-file = state_dir + "/lighttpd.pid"
##
#################################################
#################################################
##
## Logging for Lumberjacks
## ------------------------
##
server.errorlog = log_root + "/error.log"
#include "conf.d/access_log.conf"
#include "conf.d/debug.conf"
##
#################################################
#################################################
##
## Filename/File handling
## -----------------------
##
index-file.names += (
"index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
include "conf.d/mime.conf"
include "conf.d/dirlisting.conf"
server.follow-symlink = "enable"
server.upload-dires = ( "/var/tmp" )
#dir-listing.activate = "enable"
#index-file.names = ( "index.html" )
#mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", ".png" => "image/png", "" => "application/octet-stream" )
##
##################################################
##################################################
##
## Vhosts
## ----------------
##
# Using simple vhosts (conf.d/simple_vhost.conf)
##
###################################################
###################################################
##
## Mod_Rewrite
## ------------
##
#url.rewrite-if-not-file = (
# "^/(.*)$" => "/index.php?q=$1"
#)
url.rewrite-if-not-file += (
"^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
"^/([^.?]*)$" => "/index.php?q=$1",
"([a-zA-Z\-\.\/\?\=\&]*)" => "/index.php"
)
#######################################################################
##
## Simple Virtual hosting
## ------------------------
##
## http://www.lighttpd.net/documentation/simple-vhost.html
##
server.modules += ( "mod_simple_vhost" )
## If you want name-based virtual hosting add the next three settings and load
## mod_simple_vhost
##
## document-root =
## virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
## virtual-server-root + http-host + virtual-server-docroot
##
simple-vhost.server-root = vhosts_dir + "/"
simple-vhost.default-host = "default.example.com"
simple-vhost.document-root = "/htdocs/"
##
## Print some errors for finding the document-root
##
#simple-vhost.debug = "enable"
##
#######################################################################
$HTTP["host"] =~ "drupal6\.local" {
server.document-root = "/var/www/vhosts/drupal6.local/httpdocs"
accesslog.filename = "/var/www/vhosts/drupal6.local/access.log"
}
$HTTP["host"] =~ "drupal7\.local" {
server.document-root = "/var/www/vhosts/drupal7.local/httpdocs"
accesslog.filename = "/var/www/vhosts/drupal7.local/access.log"
}
$HTTP["host"] =~ "drupal8\.local" {
server.document-root = "/var/www/vhosts/drupal8.local/httpdocs"
accesslog.filename = "/var/www/vhosts/drupal8.local/access.log"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment