做者:root@\Debian :~#
网站:http://www.52d.mephp
好吧,我想说,
我喜欢root@\Debian:~#这个霸气的名字,惋惜啊,开源中国不支持超过10字符。mysql
话说,原本想搞个lighttpd+mysql+php轻量Web服务器在本地作一些测试的。
最后按官方的方法编译安装,好吧,最后发现跟本就成功不了。
最后排查,发现,利马坑爹啊。
官方包里的那个开机脚本 [doc/initscripts/rc.lighttpd] 啊!是那里来的啊!~sql
好吧,不吐槽了,看个人编译过程吧。shell
<!-- 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