lighttpd1.4.22 install on Debian

1.在lighttpd官方网站www.lighttpd.net下载lighttpd-1.4.22.tar.gz

2.新建lighttpd用户:
root@lenny:/usr/local/lighttpd/cgi-bin# useradd lighttpd -d /home/lighttpd
root@lenny:/usr/local/lighttpd/cgi-bin# passwd lighttpd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

3.验证源码的完整性:
lighttpd@lenny:~$ md5sum lighttpd-1.4.22.tar.gz
949c33a81e83f7718a47280bef21b90c lighttpd-1.4.22.tar.gz
检查生成的MD5码是否与网站提供的MD5码一致。

4.解压:
lighttpd@lenny:~$ tar -zxvf lighttpd-1.4.22.tar.gz

5.编译前配置
查看配置选项:
lighttpd@lenny:~/lighttpd-1.4.22$ ./configure --help
配置:
lighttpd@lenny:~/lighttpd-1.4.22$ ./configure --prefix=/home/lighttpd --without-pcre --without-zlib --without-bzip2

6.编译&安装:
lighttpd@lenny:~/lighttpd-1.4.22$ make;make install

7.建立目录:
lighttpd@lenny:~$ mkdir -p etc log www/cgi-bin

8.将lighttpd.conf配置文件复制到etc目录:
lighttpd@lenny:~/etc$ cp ../lighttpd-1.4.22/doc/lighttpd.conf .

9.备份原装配置文件:
lighttpd@lenny:~/etc$ cp lighttpd.conf lighttpd.conf.raw
lighttpd@lenny:~/etc$ chmod 400 lighttpd.conf.raw

10.修改lighttpd.conf,
"mod_cgi"
server.document-root = "/home/lighttpd/www/"
server.errorlog = "/home/lighttpd/log/error.log"
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".cgi" )
server.port = 9090
server.pid-file = "/home/lighttpd/lighttpd.pid"
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "" )
如果没有安装pcre模块,需要注解掉:
128 #$HTTP["url"] =~ "\.pdf$" {
129 # server.range-requests = "disable"
130 #}


11.启动lighttpd
lighttpd@lenny:~$ sbin/lighttpd -f etc/lighttpd.conf
lighttpd@lenny:~$ netstat -tnlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9090 0.0.0.0:* LISTEN 17151/lighttpd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:826 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -

12.写个简单的CGI测试程序。
/* filename: hello.c */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char **argv)
{
fprintf(stdout, "Content-Type: text/html\n\n");
fprintf(stdout, "CGI powered by Lighttpd and C\n");
exit(EXIT_SUCCESS);
}

编译CGI程序:
lighttpd@lenny:~/www/cgi-bin$ gcc -o hello.cgi hello.c

13.访问测试CGI:
http://192.168.6.130:9090/cgi-bin/hello.cgi

14.编写启、停脚本
sbin/startup
#--------------------------
#!/bin/sh

lighttpd -f /home/lighttpd/etc/lighttpd.conf
#--------------------------

sbin/shutdown
#--------------------------
#!/bin/sh

kill -9 `cat /home/lighttpd/lighttpd.pid`
#--------------------------

15.编写.bash_profile
export PATH=$PATH:/home/lighttpd/bin:/home/lighttpd/sbin
export LANG=POSIX
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值