Debian编译lighttpd-1.4.32

Debian编译lighttpd-1.4.32

作者:root@\Debian :~#
网站:http://www.52d.me

好吧,我想说,
我喜欢root@\Debian:~#这个霸气的名字,可惜啊,开源中国不支持超过10字符。

话说,本来想搞个lighttpd+mysql+php轻量Web服务器在本地做一些测试的。
最后按官方的方法编译安装,好吧,最后发现跟本就成功不了。
最后排查,发现,利马坑爹啊。
官方包里的那个开机脚本 [doc/initscripts/rc.lighttpd] 啊!是那里来的啊!~

好吧,不吐槽了,看我的编译过程吧。

一键下载解压
<!-- lang: shell -->
curl --progress http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.32.tar.gz | tar xz
进入目录
<!-- lang: shell -->
cd lighttpd-1.4.32
建立用户组与用户
<!-- lang: shell -->
groupadd www
useradd -s /sbin/nologin -g www www
查看配置帮助 / 自己撸就需要看一下
<!-- lang: shell -->
# ./configure --help
编译前配置
<!-- lang: shell -->
./configure  --prefix=/app/lighttpd --disable-ipv6 --with-pcre  --with-zlib  --with-bzip2
编译
<!-- lang: shell -->
[ "`cat /proc/cpuinfo |grep 'processor'|wc -l`" = "1" ] && make
[ "`cat /proc/cpuinfo |grep 'processor'|wc -l`" != "1" ] && make -j`cat /proc/cpuinfo |grep 'processor'|wc -l`
编译安装
<!-- lang: shell -->
make install
设置开机脚本
<!-- lang: shell -->
# Debian一系禁用这一段 / 这是一段错误的配置 / 本段来自官方
# 经过多次测试 / 各种错误
# CentOS
# cp doc/initscripts/rc.lighttpd.redhat   /etc/init.d/lighttpd
# Debian
# sed -e 's/FOO/lighttpd/g' doc/initscripts/rc.lighttpd > /etc/init.d/lighttpd
# chmod a+rx /etc/init.d/lighttpd
# 修改BIN文件路径
# sed -i 's#/usr/sbin/lighttpd#/app/lighttpd/sbin/lighttpd#g' /etc/init.d/lighttpd
建立配置
<!-- lang: shell -->
mkdir -p /app/lighttpd/etc/
cp -R doc/config/conf.d/  doc/config/vhosts.d/ doc/config/*.conf /app/lighttpd/etc/
配置
<!-- lang: shell -->
sed -i 's#server.username  = "lighttpd"#server.username  = "www"#g' /app/lighttpd/etc/lighttpd.conf
sed -i 's#server.groupname = "lighttpd"#server.groupname = "www"#g' /app/lighttpd/etc/lighttpd.conf
sed -i 's#var.server_root = "/srv/www"#var.server_root = "/home/wwwroot"#g' /app/lighttpd/etc/lighttpd.conf
sed -i 's#server_root + "/htdocs"#server_root + "/default"#g' /app/lighttpd/etc/lighttpd.conf
sed -i 's#server.use-ipv6 = "enable"#server.use-ipv6 = "disable"#g' /app/lighttpd/etc/lighttpd.conf
建立目录
<!-- lang: shell -->
mkdir /var/log/lighttpd
mkdir -p /home/wwwroot/default
建立日志
<!-- lang: shell -->
touch /var/log/lighttpd/access.log
touch /var/log/lighttpd/error.log
赋权
<!-- lang: shell -->
chown -R www:www /var/log/lighttpd/
chown -R www:www /home/wwwroot
chown -R www:www /home/wwwroot/default
启动
<!-- lang: shell -->
# 启动 / 由于上面开机脚本错误 / 没有配置 / 所以 / 本命令无效
# /etc/init.d/lighttpd start
# 启动lighttpd
ln -s /app/lighttpd/sbin/lighttpd /usr/local/sbin/lighttpd
/app/lighttpd/sbin/lighttpd -f /app/lighttpd/etc/lighttpd.conf
查看端口
<!-- lang: shell -->
netstat -ntlp
查看程式启动
<!-- lang: shell -->
ps -A | grep lighttpd
开机启动
<!-- lang: shell -->
# 因开机脚本错误 / 本句失效
# insserv lighttpd

转载于:https://my.oschina.net/mehost/blog/161391

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值