1*4882a593Smuzhiyun# lighttpd configuration file 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# use it as a base for lighttpd 1.0.0 and above 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $ 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun############ Options you really have to take care of #################### 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun## modules to load 10*4882a593Smuzhiyun# at least mod_access and mod_accesslog should be loaded 11*4882a593Smuzhiyun# all other module should only be loaded if really neccesary 12*4882a593Smuzhiyun# - saves some time 13*4882a593Smuzhiyun# - saves memory 14*4882a593Smuzhiyunserver.modules = ( 15*4882a593Smuzhiyun# "mod_rewrite", 16*4882a593Smuzhiyun# "mod_redirect", 17*4882a593Smuzhiyun# "mod_alias", 18*4882a593Smuzhiyun "mod_access", 19*4882a593Smuzhiyun# "mod_cml", 20*4882a593Smuzhiyun# "mod_trigger_b4_dl", 21*4882a593Smuzhiyun# "mod_auth", 22*4882a593Smuzhiyun# "mod_status", 23*4882a593Smuzhiyun# "mod_setenv", 24*4882a593Smuzhiyun# "mod_fastcgi", 25*4882a593Smuzhiyun# "mod_proxy", 26*4882a593Smuzhiyun# "mod_simple_vhost", 27*4882a593Smuzhiyun# "mod_evhost", 28*4882a593Smuzhiyun# "mod_userdir", 29*4882a593Smuzhiyun# "mod_cgi", 30*4882a593Smuzhiyun# "mod_compress", 31*4882a593Smuzhiyun# "mod_ssi", 32*4882a593Smuzhiyun# "mod_usertrack", 33*4882a593Smuzhiyun# "mod_expire", 34*4882a593Smuzhiyun# "mod_secdownload", 35*4882a593Smuzhiyun# "mod_rrdtool", 36*4882a593Smuzhiyun# "mod_webdav", 37*4882a593Smuzhiyun "mod_accesslog" ) 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun## a static document-root, for virtual-hosting take look at the 40*4882a593Smuzhiyun## server.virtual-* options 41*4882a593Smuzhiyunserver.document-root = "/www/pages/" 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun## where to send error-messages to 44*4882a593Smuzhiyunserver.errorlog = "/www/logs/lighttpd.error.log" 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun# files to check for if .../ is requested 47*4882a593Smuzhiyunindex-file.names = ( "index.php", "index.html", 48*4882a593Smuzhiyun "index.htm", "default.htm" ) 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun## set the event-handler (read the performance section in the manual) 51*4882a593Smuzhiyun# server.event-handler = "freebsd-kqueue" # needed on OS X 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun# mimetype mapping 54*4882a593Smuzhiyunmimetype.assign = ( 55*4882a593Smuzhiyun ".pdf" => "application/pdf", 56*4882a593Smuzhiyun ".sig" => "application/pgp-signature", 57*4882a593Smuzhiyun ".spl" => "application/futuresplash", 58*4882a593Smuzhiyun ".class" => "application/octet-stream", 59*4882a593Smuzhiyun ".ps" => "application/postscript", 60*4882a593Smuzhiyun ".torrent" => "application/x-bittorrent", 61*4882a593Smuzhiyun ".dvi" => "application/x-dvi", 62*4882a593Smuzhiyun ".gz" => "application/x-gzip", 63*4882a593Smuzhiyun ".pac" => "application/x-ns-proxy-autoconfig", 64*4882a593Smuzhiyun ".swf" => "application/x-shockwave-flash", 65*4882a593Smuzhiyun ".tar.gz" => "application/x-tgz", 66*4882a593Smuzhiyun ".tgz" => "application/x-tgz", 67*4882a593Smuzhiyun ".tar" => "application/x-tar", 68*4882a593Smuzhiyun ".zip" => "application/zip", 69*4882a593Smuzhiyun ".mp3" => "audio/mpeg", 70*4882a593Smuzhiyun ".m3u" => "audio/x-mpegurl", 71*4882a593Smuzhiyun ".wma" => "audio/x-ms-wma", 72*4882a593Smuzhiyun ".wax" => "audio/x-ms-wax", 73*4882a593Smuzhiyun ".ogg" => "application/ogg", 74*4882a593Smuzhiyun ".wav" => "audio/x-wav", 75*4882a593Smuzhiyun ".gif" => "image/gif", 76*4882a593Smuzhiyun ".jpg" => "image/jpeg", 77*4882a593Smuzhiyun ".jpeg" => "image/jpeg", 78*4882a593Smuzhiyun ".png" => "image/png", 79*4882a593Smuzhiyun ".xbm" => "image/x-xbitmap", 80*4882a593Smuzhiyun ".xpm" => "image/x-xpixmap", 81*4882a593Smuzhiyun ".xwd" => "image/x-xwindowdump", 82*4882a593Smuzhiyun ".css" => "text/css", 83*4882a593Smuzhiyun ".html" => "text/html", 84*4882a593Smuzhiyun ".htm" => "text/html", 85*4882a593Smuzhiyun ".js" => "text/javascript", 86*4882a593Smuzhiyun ".asc" => "text/plain", 87*4882a593Smuzhiyun ".c" => "text/plain", 88*4882a593Smuzhiyun ".cpp" => "text/plain", 89*4882a593Smuzhiyun ".log" => "text/plain", 90*4882a593Smuzhiyun ".conf" => "text/plain", 91*4882a593Smuzhiyun ".text" => "text/plain", 92*4882a593Smuzhiyun ".txt" => "text/plain", 93*4882a593Smuzhiyun ".dtd" => "text/xml", 94*4882a593Smuzhiyun ".xml" => "text/xml", 95*4882a593Smuzhiyun ".mpeg" => "video/mpeg", 96*4882a593Smuzhiyun ".mpg" => "video/mpeg", 97*4882a593Smuzhiyun ".mov" => "video/quicktime", 98*4882a593Smuzhiyun ".qt" => "video/quicktime", 99*4882a593Smuzhiyun ".avi" => "video/x-msvideo", 100*4882a593Smuzhiyun ".asf" => "video/x-ms-asf", 101*4882a593Smuzhiyun ".asx" => "video/x-ms-asf", 102*4882a593Smuzhiyun ".wmv" => "video/x-ms-wmv", 103*4882a593Smuzhiyun ".bz2" => "application/x-bzip", 104*4882a593Smuzhiyun ".tbz" => "application/x-bzip-compressed-tar", 105*4882a593Smuzhiyun ".tar.bz2" => "application/x-bzip-compressed-tar" 106*4882a593Smuzhiyun ) 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun# Use the "Content-Type" extended attribute to obtain mime type if possible 109*4882a593Smuzhiyun#mimetype.use-xattr = "enable" 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun## send a different Server: header 113*4882a593Smuzhiyun## be nice and keep it at lighttpd 114*4882a593Smuzhiyun# server.tag = "lighttpd" 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun#### accesslog module 117*4882a593Smuzhiyunaccesslog.filename = "/www/logs/access.log" 118*4882a593Smuzhiyundebug.log-request-handling = "enable" 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun## deny access the file-extensions 124*4882a593Smuzhiyun# 125*4882a593Smuzhiyun# ~ is for backupfiles from vi, emacs, joe, ... 126*4882a593Smuzhiyun# .inc is often used for code includes which should in general not be part 127*4882a593Smuzhiyun# of the document-root 128*4882a593Smuzhiyunurl.access-deny = ( "~", ".inc" ) 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun$HTTP["url"] =~ "\.pdf$" { 131*4882a593Smuzhiyun server.range-requests = "disable" 132*4882a593Smuzhiyun} 133*4882a593Smuzhiyun 134*4882a593Smuzhiyun## 135*4882a593Smuzhiyun# which extensions should not be handle via static-file transfer 136*4882a593Smuzhiyun# 137*4882a593Smuzhiyun# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi 138*4882a593Smuzhiyunstatic-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun######### Options that are good to be but not neccesary to be changed ####### 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun## bind to port (default: 80) 143*4882a593Smuzhiyun#server.port = 81 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun## bind to localhost (default: all interfaces) 146*4882a593Smuzhiyun#server.bind = "grisu.home.kneschke.de" 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun## error-handler for status 404 149*4882a593Smuzhiyun#server.error-handler-404 = "/error-handler.html" 150*4882a593Smuzhiyun#server.error-handler-404 = "/error-handler.php" 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun## to help the rc.scripts 153*4882a593Smuzhiyun#server.pid-file = "/var/run/lighttpd.pid" 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun 156*4882a593Smuzhiyun###### virtual hosts 157*4882a593Smuzhiyun## 158*4882a593Smuzhiyun## If you want name-based virtual hosting add the next three settings and load 159*4882a593Smuzhiyun## mod_simple_vhost 160*4882a593Smuzhiyun## 161*4882a593Smuzhiyun## document-root = 162*4882a593Smuzhiyun## virtual-server-root + virtual-server-default-host + virtual-server-docroot 163*4882a593Smuzhiyun## or 164*4882a593Smuzhiyun## virtual-server-root + http-host + virtual-server-docroot 165*4882a593Smuzhiyun## 166*4882a593Smuzhiyun#simple-vhost.server-root = "/home/weigon/wwwroot/servers/" 167*4882a593Smuzhiyun#simple-vhost.default-host = "grisu.home.kneschke.de" 168*4882a593Smuzhiyun#simple-vhost.document-root = "/pages/" 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun 171*4882a593Smuzhiyun## 172*4882a593Smuzhiyun## Format: <errorfile-prefix><status-code>.html 173*4882a593Smuzhiyun## -> ..../status-404.html for 'File not found' 174*4882a593Smuzhiyun#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-" 175*4882a593Smuzhiyun 176*4882a593Smuzhiyun## virtual directory listings 177*4882a593Smuzhiyun#dir-listing.activate = "enable" 178*4882a593Smuzhiyun 179*4882a593Smuzhiyun## enable debugging 180*4882a593Smuzhiyun#debug.log-request-header = "enable" 181*4882a593Smuzhiyun#debug.log-response-header = "enable" 182*4882a593Smuzhiyun#debug.log-request-handling = "enable" 183*4882a593Smuzhiyun#debug.log-file-not-found = "enable" 184*4882a593Smuzhiyun 185*4882a593Smuzhiyun### only root can use these options 186*4882a593Smuzhiyun# 187*4882a593Smuzhiyun# chroot() to directory (default: no chroot() ) 188*4882a593Smuzhiyun#server.chroot = "/" 189*4882a593Smuzhiyun 190*4882a593Smuzhiyun## change uid to <uid> (default: don't care) 191*4882a593Smuzhiyun#server.username = "wwwrun" 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun## change uid to <uid> (default: don't care) 194*4882a593Smuzhiyun#server.groupname = "wwwrun" 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun#### compress module 197*4882a593Smuzhiyun#compress.cache-dir = "/tmp/lighttpd/cache/compress/" 198*4882a593Smuzhiyun#compress.filetype = ("text/plain", "text/html") 199*4882a593Smuzhiyun 200*4882a593Smuzhiyun#### proxy module 201*4882a593Smuzhiyun## read proxy.txt for more info 202*4882a593Smuzhiyun#proxy.server = ( ".php" => 203*4882a593Smuzhiyun# ( "localhost" => 204*4882a593Smuzhiyun# ( 205*4882a593Smuzhiyun# "host" => "192.168.0.101", 206*4882a593Smuzhiyun# "port" => 80 207*4882a593Smuzhiyun# ) 208*4882a593Smuzhiyun# ) 209*4882a593Smuzhiyun# ) 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun#### fastcgi module 212*4882a593Smuzhiyun## read fastcgi.txt for more info 213*4882a593Smuzhiyun## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini 214*4882a593Smuzhiyun#fastcgi.server = ( ".php" => 215*4882a593Smuzhiyun# ( "localhost" => 216*4882a593Smuzhiyun# ( 217*4882a593Smuzhiyun# "socket" => "/tmp/php-fastcgi.socket", 218*4882a593Smuzhiyun# "bin-path" => "/usr/local/bin/php" 219*4882a593Smuzhiyun# ) 220*4882a593Smuzhiyun# ) 221*4882a593Smuzhiyun# ) 222*4882a593Smuzhiyun 223*4882a593Smuzhiyun#### CGI module 224*4882a593Smuzhiyun#cgi.assign = ( ".pl" => "/usr/bin/perl", 225*4882a593Smuzhiyun# ".cgi" => "/usr/bin/perl" ) 226*4882a593Smuzhiyun# 227*4882a593Smuzhiyun 228*4882a593Smuzhiyun#### SSL engine 229*4882a593Smuzhiyun#ssl.engine = "enable" 230*4882a593Smuzhiyun#ssl.pemfile = "server.pem" 231*4882a593Smuzhiyun 232*4882a593Smuzhiyun#### status module 233*4882a593Smuzhiyun#status.status-url = "/server-status" 234*4882a593Smuzhiyun#status.config-url = "/server-config" 235*4882a593Smuzhiyun 236*4882a593Smuzhiyun#### auth module 237*4882a593Smuzhiyun## read authentication.txt for more info 238*4882a593Smuzhiyun#auth.backend = "plain" 239*4882a593Smuzhiyun#auth.backend.plain.userfile = "lighttpd.user" 240*4882a593Smuzhiyun#auth.backend.plain.groupfile = "lighttpd.group" 241*4882a593Smuzhiyun 242*4882a593Smuzhiyun#auth.backend.ldap.hostname = "localhost" 243*4882a593Smuzhiyun#auth.backend.ldap.base-dn = "dc=my-domain,dc=com" 244*4882a593Smuzhiyun#auth.backend.ldap.filter = "(uid=$)" 245*4882a593Smuzhiyun 246*4882a593Smuzhiyun#auth.require = ( "/server-status" => 247*4882a593Smuzhiyun# ( 248*4882a593Smuzhiyun# "method" => "digest", 249*4882a593Smuzhiyun# "realm" => "download archiv", 250*4882a593Smuzhiyun# "require" => "user=jan" 251*4882a593Smuzhiyun# ), 252*4882a593Smuzhiyun# "/server-config" => 253*4882a593Smuzhiyun# ( 254*4882a593Smuzhiyun# "method" => "digest", 255*4882a593Smuzhiyun# "realm" => "download archiv", 256*4882a593Smuzhiyun# "require" => "valid-user" 257*4882a593Smuzhiyun# ) 258*4882a593Smuzhiyun# ) 259*4882a593Smuzhiyun 260*4882a593Smuzhiyun#### url handling modules (rewrite, redirect, access) 261*4882a593Smuzhiyun#url.rewrite = ( "^/$" => "/server-status" ) 262*4882a593Smuzhiyun#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" ) 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun#### both rewrite/redirect support back reference to regex conditional using %n 265*4882a593Smuzhiyun#$HTTP["host"] =~ "^www\.(.*)" { 266*4882a593Smuzhiyun# url.redirect = ( "^/(.*)" => "http://%1/$1" ) 267*4882a593Smuzhiyun#} 268*4882a593Smuzhiyun 269*4882a593Smuzhiyun# 270*4882a593Smuzhiyun# define a pattern for the host url finding 271*4882a593Smuzhiyun# %% => % sign 272*4882a593Smuzhiyun# %0 => domain name + tld 273*4882a593Smuzhiyun# %1 => tld 274*4882a593Smuzhiyun# %2 => domain name without tld 275*4882a593Smuzhiyun# %3 => subdomain 1 name 276*4882a593Smuzhiyun# %4 => subdomain 2 name 277*4882a593Smuzhiyun# 278*4882a593Smuzhiyun#evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/" 279*4882a593Smuzhiyun 280*4882a593Smuzhiyun#### expire module 281*4882a593Smuzhiyun#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") 282*4882a593Smuzhiyun 283*4882a593Smuzhiyun#### ssi 284*4882a593Smuzhiyun#ssi.extension = ( ".shtml" ) 285*4882a593Smuzhiyun 286*4882a593Smuzhiyun#### rrdtool 287*4882a593Smuzhiyun#rrdtool.binary = "/usr/bin/rrdtool" 288*4882a593Smuzhiyun#rrdtool.db-name = "/var/www/lighttpd.rrd" 289*4882a593Smuzhiyun 290*4882a593Smuzhiyun#### setenv 291*4882a593Smuzhiyun#setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" ) 292*4882a593Smuzhiyun#setenv.add-response-header = ( "X-Secret-Message" => "42" ) 293*4882a593Smuzhiyun 294*4882a593Smuzhiyun## for mod_trigger_b4_dl 295*4882a593Smuzhiyun# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db" 296*4882a593Smuzhiyun# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" ) 297*4882a593Smuzhiyun# trigger-before-download.trigger-url = "^/trigger/" 298*4882a593Smuzhiyun# trigger-before-download.download-url = "^/download/" 299*4882a593Smuzhiyun# trigger-before-download.deny-url = "http://127.0.0.1/index.html" 300*4882a593Smuzhiyun# trigger-before-download.trigger-timeout = 10 301*4882a593Smuzhiyun 302*4882a593Smuzhiyun## for mod_cml 303*4882a593Smuzhiyun## don't forget to add index.cml to server.indexfiles 304*4882a593Smuzhiyun# cml.extension = ".cml" 305*4882a593Smuzhiyun# cml.memcache-hosts = ( "127.0.0.1:11211" ) 306*4882a593Smuzhiyun 307*4882a593Smuzhiyun#### variable usage: 308*4882a593Smuzhiyun## variable name without "." is auto prefixed by "var." and becomes "var.bar" 309*4882a593Smuzhiyun#bar = 1 310*4882a593Smuzhiyun#var.mystring = "foo" 311*4882a593Smuzhiyun 312*4882a593Smuzhiyun## integer add 313*4882a593Smuzhiyun#bar += 1 314*4882a593Smuzhiyun## string concat, with integer cast as string, result: "www.foo1.com" 315*4882a593Smuzhiyun#server.name = "www." + mystring + var.bar + ".com" 316*4882a593Smuzhiyun## array merge 317*4882a593Smuzhiyun#index-file.names = (foo + ".php") + index-file.names 318*4882a593Smuzhiyun#index-file.names += (foo + ".php") 319*4882a593Smuzhiyun 320*4882a593Smuzhiyun#### include 321*4882a593Smuzhiyun#include /etc/lighttpd/lighttpd-inc.conf 322*4882a593Smuzhiyun## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf" 323*4882a593Smuzhiyun#include "lighttpd-inc.conf" 324*4882a593Smuzhiyun 325*4882a593Smuzhiyun#### include_shell 326*4882a593Smuzhiyun#include_shell "echo var.a=1" 327*4882a593Smuzhiyun## the above is same as: 328*4882a593Smuzhiyun#var.a=1 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun# include other config file fragments from lighttpd.d subdir 331*4882a593Smuzhiyuninclude_shell "find /etc/lighttpd.d -maxdepth 1 -name '*.conf' -exec cat {} \;" 332