1. cat lighttpd.conf 
  2. var.server_root = "/usr/local/lighttpd" 
  3. var.log_root    = "/data/html/logs" 
  4. compress.filetype = ("text/plain""text/html"
  5. server.modules  = ( 
  6.   "mod_access"
  7.   "mod_accesslog"
  8.   "mod_rewrite"
  9.   "mod_redirect"
  10.   "mod_alias"
  11.   "mod_fastcgi"
  12.   "mod_simple_vhost"
  13.   "mod_evhost"
  14.   "mod_expire"
  15.   "mod_compress"
  16.   "mod_cgi"
  17.   "mod_auth"
  18. server.port = 80 
  19. server.use-ipv6 = "disable" 
  20. server.username  = "nobody" 
  21. server.groupname = "nobody" 
  22. server.document-root = server_root + "/htdocs" 
  23. server.pid-file = server_root + "/var/lighttpd.pid" 
  24. server.errorlog = log_root + "/error.log" 
  25. accesslog.filename = log_root + "/access.log" 
  26. server.event-handler = "linux-sysepoll" 
  27. server.network-backend = "linux-sendfile" 
  28. server.max-fds = 2048 
  29. server.max-worker = 5 
  30. server.stat-cache-engine = "fam" 
  31. server.max-connections = 1024 
  32. server.max-request-size = 20000000 
  33. server.follow-symlink = "enable" 
  34. server.upload-dirs = ( server_root + "/var/upload-dirs" ) 
  35. index-file.names += ( 
  36.   "index.php","index.xhtml""index.html""index.htm""default.htm" 
  37. url.access-deny = ( "~"".inc" ) 
  38. $HTTP["url"] =~ "\.pdf$" { 
  39.   server.range-requests = "disable" 
  40. $HTTP["url"] =~ "(\.png|\.css|\.js|\.jpg|\.gif)$"
  41.   expire.url = ( "" => "access 2 days" ) 
  42. static-file.exclude-extensions = ( ".php"".pl"".fcgi"".scgi" ) 
  43. fastcgi.server = ( ".php" =>  
  44.   ( "local" => 
  45.     ( "socket" => server_root + "/var/sockets/fastcgi.socket"
  46.       "bin-path" => "/usr/local/php/bin/php-cgi"
  47.       "max-procs" => 5, 
  48.       "broken-scriptfilename" => "enable"
  49.     ) 
  50.   ) 
  51. include "conf.d/mime.conf" 
  52. include "conf.d/dirlisting.conf" 
  53. include "vhosts.d/example.com.conf" 
  54. include "vdir.conf" 

 

   
   
   
   
  1. cat example.com.conf  
  2. $HTTP["host"] == "www.example.com" { 
  3.     server_name = "www.example.com" 
  4.     server.name = server_name 
  5.     server.document-root = "/data/html/example" 
  6.     accesslog.filename = "/data/html/logs/example-access.log" 
  7.     server.errorlog = "/data/html/logs/example-error.log" 

 

   
   
   
   
  1. cat vdir.conf  
  2. alias.url += ( "/cacti" => "/data/html/cacti/"
  3.               "/pureftpd" => "/data/html/pureftpd"
  4.               "/ping" => "/usr/local/smokeping/htdocs"
  5.               "/nagios/cgi-bin" => "/usr/local/nagios/sbin"
  6.               "/nagios" => "/data/html/nagios"
  7. $HTTP["url"] =~ "^\/cacti\/"
  8.   accesslog.filename = log_root + "/cacti-access.log" 
  9.   server.errorlog = log_root + "/cacti-error.log" 
  10.   auth.debug = 0 
  11.   auth.backend = "htpasswd" 
  12.   auth.backend.htpasswd.userfile = "/data/html/.htpasswd/cacti.htpasswd" 
  13.   auth.require = ( "" => 
  14.                       ( "method" => "basic"
  15.                         "realm" => "cacti"
  16.                         "require" => "valid-user" 
  17.                       ) 
  18.   ) 
  19. $HTTP["url"] =~ "^\/pureftpd\/"
  20.   accesslog.filename = log_root + "/pureftpd-access.log" 
  21.   server.errorlog = log_root + "/pureftpd-error.log" 
  22.   auth.debug = 0 
  23.   auth.backend = "htpasswd" 
  24.   auth.backend.htpasswd.userfile = "/data/html/.htpasswd/pureftpd.htpasswd" 
  25.   auth.require = ( "" => 
  26.                       ( "method" => "basic"
  27.                         "realm" => "pureftpd"
  28.                         "require" => "valid-user" 
  29.                       ) 
  30.   ) 
  31. $HTTP["url"] =~ "^\/ping\/"
  32.   accesslog.filename = log_root + "/smokeping-access.log" 
  33.   server.errorlog = log_root + "/smokeping-error.log" 
  34.   cgi.assign = ( ".cgi" => "/usr/bin/speedy" ) 
  35.   index-file.names = ( "index.html""smokeping.cgi" ) 
  36.   $HTTP["request-method"] != "POST" { 
  37.       auth.debug = 0 
  38.       auth.backend = "htpasswd" 
  39.       auth.backend.htpasswd.userfile = "/data/html/.htpasswd/smokeping.htpasswd" 
  40.       auth.require = ( "" => 
  41.                           ( "method" => "basic"
  42.                             "realm" => "smokeping"
  43.                             "require" => "valid-user" 
  44.                           ) 
  45.       ) 
  46.    } 
  47. $HTTP["url"] =~ "^\/nagios\/"
  48.   accesslog.filename = log_root + "/nagios-access.log" 
  49.   server.errorlog = log_root + "/nagios-error.log" 
  50.   $HTTP["url"] =~ "^\/nagios\/cgi-bin\/" { 
  51.       cgi.assign = ( ".cgi" => "" ) 
  52.   } 
  53.   auth.debug = 0 
  54.   auth.backend = "htpasswd" 
  55.   auth.backend.htpasswd.userfile = "/data/html/.htpasswd/nagios.htpasswd" 
  56.   auth.require = ( "" => 
  57.                       ( "method" => "basic"
  58.                         "realm" => "nagios"
  59.                         "require" => "valid-user" 
  60.                       ) 
  61.   )