1. 进入lighttpd要放置的文件夹
cd /usr/local
2. 安装lighttpd
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.37.tar.gz
tar -zxvf lighttpd-1.4.37
./configure --prefix /usr/local/lighttpd
make & make install
3. 建立启动项
cd lighttpd-1.4.37
cp doc/initscripts/rc.lighttpd.redhat /etc/init.d/lighttpd
vi /etc/init.d/lighttpd
lighttpd="/usr/local/lighttpd/sbin/lighttpd"
chmod a+rx /etc/init.d/lighttpd
4. 复制配置文件到/etc/lighttpd
mkdir /etc/lighttpd
cp -R doc/config/conf.d/ /etc/lighttpd/conf.d/
cp -R doc/config/vhosts.d/ /etc/lighttpd/vhosts.d/
cp doc/config/*.conf /etc/lighttpd/
5. 根据lighttpd.conf的设定,可自定义,建立lighttpd帐户和组
useradd lighttpd 命令省略
6. 修改modules.conf
server.modules = (
"mod_access",
"mod_fastcgi",
"mod_rewrite",
"mod_accesslog",
)
server.document-root = "/srv/www/htdocs"
server.pid-file = "/opt/test/lighttpd.pid"
7. 修改conf.d/fastcgi
fastcgi.server = (
".py" => ((
"socket" => "/tmp/fastcgi.python.socket",
"bin-path" => "/srv/www/htdocs/test.py",
"max-procs" => 1,
"bin-environment" => (
"REAL_SCRIPT_NAME" => ""
),
"check-local" => "disable"
)),
)