Lighttpd.conf examples

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
 
 
(未显示1个用户的10个中间版本)
第1行: 第1行:
 
  server.modules = (  
 
  server.modules = (  
"mod_setenv",
+
  "mod_setenv",
        "mod_access",  
+
  "mod_access",  
"mod_alias",
+
  "mod_alias",
"mod_cgi",
+
  "mod_cgi",
"mod_accesslog" )
+
  "mod_accesslog" )
  
  server.document-root             = "/var/www/html"
+
  server.document-root       = "/var/www/html"
 
  server.errorlog            = "/var/log/lighttpd/error.log"
 
  server.errorlog            = "/var/log/lighttpd/error.log"
 
  server.indexfiles          = ( "index.php", "index.html",  
 
  server.indexfiles          = ( "index.php", "index.html",  
第21行: 第21行:
 
  accesslog.filename          = "/var/log/lighttpd/access.log"
 
  accesslog.filename          = "/var/log/lighttpd/access.log"
 
  url.access-deny            = ( "~", ".inc" )
 
  url.access-deny            = ( "~", ".inc" )
  server.pid-file             = "/var/run/lighttpd.pid"
+
  server.pid-file             = "/var/run/lighttpd.pid"
  server.username           = "www-data"
+
  server.username             = "www-data"
  server.groupname           = "www-data"
+
  server.groupname           = "www-data"
 
   
 
   
 
  cgi.assign  = ( ".awk"    => "/usr/bin/awk",
 
  cgi.assign  = ( ".awk"    => "/usr/bin/awk",
 
  ".py"      => "/usr/bin/python",
 
  ".py"      => "/usr/bin/python",
 +
".pl"      => "/usr/bin/perl",
 +
".cgi"      => "/usr/bin/perl",
 
  ".sh"      => "",
 
  ".sh"      => "",
 
  "/isearch" => "",
 
  "/isearch" => "",
第34行: 第36行:
 
  alias.url = ( "/cgi-bin/" => "/usr/lib/cgi-bin/",
 
  alias.url = ( "/cgi-bin/" => "/usr/lib/cgi-bin/",
 
    "/images/"  => "/var/www/images/" )
 
    "/images/"  => "/var/www/images/" )
 +
 +
fastcgi.server = ( ".php" =>
 +
  (( "host" => "127.0.0.1",
 +
      "port" => 1026,
 +
      "bin-path" => "/usr/local/bin/php -c /usr/local/etc/php.ini" 
 +
  ))
 +
)
 +
需要 php 支持 fastcgi
 +
php -v' and it should display '(cgi-fcgi)'
 +
若不是,请重新编译php
 +
$ ./configure \
 +
--prefix=/usr/local/php-fcgi \
 +
--enable-fastcgi \
 +
--enable-force-cgi-redirect \
 +
--with-config-file-path=/usr/local/etc \
 +
--with-mysql
 +
make
 +
make install
 +
 +
/usr/local/bin/php -v
 +
PHP 4.3.10 (cgi-fcgi) (built: Mar  6 2007 17:15:59)
 +
Copyright (c) 1997-2004 The PHP Group
 +
 +
参考: http://bbs.linuxsky.net/thread-4206-1-1.html
 +
 +
[[Category:Lighttpd]]

2010年8月22日 (日) 02:48的最后版本

server.modules = ( 
 "mod_setenv",
 "mod_access", 
 "mod_alias",
 "mod_cgi",
 "mod_accesslog" )
server.document-root       = "/var/www/html"
server.errorlog            = "/var/log/lighttpd/error.log"
server.indexfiles          = ( "index.php", "index.html", 
                               "index.htm", "default.htm" )
mimetype.assign            = (  
  ".pdf"          =>      "application/pdf",
	:
	: (omitted)
	:
  ".sig"          =>      "application/pgp-signature",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv"
 )
accesslog.filename          = "/var/log/lighttpd/access.log"
url.access-deny             = ( "~", ".inc" )
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"

cgi.assign  = ( ".awk"     => "/usr/bin/awk",
				".py"      => "/usr/bin/python",
				".pl"      => "/usr/bin/perl",
				".cgi"      => "/usr/bin/perl",
				".sh"      => "",
				"/isearch" => "",
				"/ifetch"  => "",
				"/ihtml"   => "",
				"/time"    => "" )
alias.url = ( "/cgi-bin/" => "/usr/lib/cgi-bin/",
			  "/images/"  => "/var/www/images/" )
fastcgi.server = ( ".php" =>
  (( "host" => "127.0.0.1",
     "port" => 1026,
     "bin-path" => "/usr/local/bin/php -c /usr/local/etc/php.ini"  
  ))
)

需要 php 支持 fastcgi

php -v' and it should display '(cgi-fcgi)'

若不是,请重新编译php

$ ./configure \
--prefix=/usr/local/php-fcgi \
--enable-fastcgi \
--enable-force-cgi-redirect \
--with-config-file-path=/usr/local/etc \
--with-mysql
make 
make install

/usr/local/bin/php -v
PHP 4.3.10 (cgi-fcgi) (built: Mar  6 2007 17:15:59)
Copyright (c) 1997-2004 The PHP Group

参考: http://bbs.linuxsky.net/thread-4206-1-1.html

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱