Linux發行版本:Fedora 14 i686
Lighttpd源碼包:lighttpd-1.4.32.tar.gz
1、安裝Lighttpd依賴軟體。
FIXME
2、解壓縮源碼包並安裝軟體
# tar -zxf lighttpd-1.4.32.tar.gz
# cd lighttpd-1.4.32
# ./configure --prefix=/usr/local/lighttpd-1.4.32 註:--prefix指定安裝路徑,預設為[/usr/local]
# make
# make install
3、編寫設定檔
# mkdir /etc/lighttpd
# vim lighttpd.conf
內容如下:
# 路徑:/etc/lighttpd/lighttpd.conf
########## 基本配置 ##########
# 載入模組
server.modules = ("mod_accesslog", "mod_fastcgi")
# 基本變數
var.server_root = "/var/www/lighttpd"
var.log_root = "/var/log/lighttpd"
# 伺服器根路徑
server.document-root = server_root
# 伺服器監聽連接埠
server.port = 80
# 伺服器日誌路徑
server.errorlog = log_root + "/error.log"
accesslog.filename = log_root + "/access.log"
# 首頁檔案
index-file.names += (
"index.html", "index.php"
)
########## 常用配置 ##########
# 運行使用者及使用者組,啟動使用者須有root許可權
server.username = "lighttpd"
server.groupname = "lighttpd"
########## CGI配置 ##########
fastcgi.server = ( ".php" => # 檔案擴充。Lighttpd內部提供FastCGI載入均衡
( "php-local" => # 可選。用於mod_status統計,指示處理該檔案擴充的幕後處理器
(
# "socket" => "/var/run/php-fastcgi-1.socket", # FIXME 實現
"host" => "127.0.0.1", # 指定socket或者host+port。
"port" => 9999,
"bin-path" => "/usr/bin/php-cgi", # 如果本地FastCGI沒有運行,該路徑本地FastCGI將被啟動
)
),
)
FIXME
4、添加Lighttpd命令到PATH和sudo環境
添加Lighttpd命令道PATH很簡單,不再贅述。
使用visudo命令或者直接編輯/etc/sudoers,把Lighttpd的bin路徑加入到secure_path,如下所示:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/lib/lighttpd-1.4.32/sbin 註:secure_path是sudo的PATH環境
5、運行Lighttpd
# lighttpd -f /etc/lighttpd/lighttpd.conf -m /usr/local/lighttpd-1.4.32/lib 註:-m指定模組路徑,預設為[/usr/local/lib]