thttpd支持php吗,轻量型thttpd+php5

下载php-5.2.11-thttpd-2.25b

thttpd $> wget http://download2.3tera.net/oss/files/osm/thttpd-2.25b/php-5.2.11-thttpd-2.25b.tar.bz2

下载 thttpd-2.25b

thttpd $> wget http://www.acme.com/software/thttpd/thttpd-2.25b.tar.gz

1. 创建用户

thttpd $> groupadd -g 33 www

thttpd $> useradd -g 33 www

2. 编译php-5.2.11 作为

3.安装 thttpd-2.25b

thttpd $> tar zxvf thttpd-2.25b.tar.gz

thttpd $> cd thttpd-2.25b

thttpd $> ./configure –prefix=/usr/local/thttpd

thttpd $> sed -i ‘s#getline#get_line#g’ extras/htpasswd.c #在这里必须要修改一下htpasswd.c源码,不然会出现

htpasswd.c:52: error: conflicting types for ‘getline’

/usr/include/stdio.h:655: error: previous declaration of ‘getline’ was here

htpasswd.c:52: error: conflicting types for ‘getline’

/usr/include/stdio.h:655: error: previous declaration of ‘getline’ was here

make[1]: *** [htpasswd.o] Error 1

make[1]: Leaving directory `/root/thttpd-2.25b/extras’

make: *** [subdirs] Error 2

原因是getline 已加入 POSIX 2008,可以把extras/htpasswd.c 里面的getline重命名为get_line或别的。

解决错误参考 :http://blog.lytsing.org/archives/387.html

thttpd $> mkdir -p /usr/local/thttpd/man/man1 # 安装脚本没有这步,不然会报错!

thttpd $> make

thttpd $> make install

3.添加配置

thttpd $> cd /usr/local/thttpd

thttpd $> mkdir {etc,logs}

thttpd $> cd etc

thttpd $> vim thttpd.conf

port=80

user=www

chroot

host=0.0.0.0

logfile=/usr/local/thttpd/logs/thttpd.log

pidfile=/usr/local/thttpd/logs/thttpd.pid

throttles=/usr/local/thttpd/etc/throttle.conf

urlpat=*.txt|*.mp3

charset=utf-8

dir=/var/www

cgipat=/usr/local/thttpd/www/cgi-bin/*

thttpd $> vim throttle.conf

*.jpg|*.gif 50000 # 对所有 jpg gif 限速 5万字节每秒

*.mpg 20000 # 对访问所有的 mpg 文件限速 2万字节每秒

dir/* 20000 # 对访问 dir/ 目录下所有文件限速 一秒钟 2万个字节

4. 创建启动文件

thttpd $> vim /etc/init.d/thttpd

#!/bin/bash

COMMAND=/usr/local/thttpd/sbin/thttpd

CONFIG=/usr/local/thttpd/etc/thttpd.conf

PID=`cat /usr/local/thttpd/logs/thttpd.pid`

function_start_thttpd()

{

printf “Starting THTTPD….\n”

$COMMAND -C $CONFIG 2>&1 >/dev/null&

}

function_stop_thttpd()

{

printf “Stoping THTTPD….\n”

kill $PID

}

if [ "$1" = "start" ]; then

function_start_thttpd

elif [ "$1" = "stop" ];then

function_stop_thttpd

else

printf “Usage: thttpd {start|stop}”"

fi

5.访问测试

启动服务

thttpd $> /etc/init.d/thttpd start

在另一台电脑打开浏览器输入 IP

thttpd1.jpg

thttpd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值