做者: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