the lighttpd 1.4.29 -- startup script

本文提供两种在Ubuntu环境下配置Lighttpd服务的方法。第一种方法涉及编辑init.d脚本并设置Lighttpd及其依赖项的具体路径。第二种方法则通过创建或修改/etc/init.d/lighttpd脚本来实现启动、停止、重启等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Solution 1 :

Coping this [url]http://redmine.lighttpd.net/wiki/1/ScriptsUbuntu[/url]
to your folder /etc/init.d/lighttpd, and fix the path in that file as the following.



USER=www-data
GROUP=www-data
PATH=/sbin:/bin:/usr/sbin:/usr/bin
LIGHTY_DAEMON=/usr/local/lighttpd/sbin/lighttpd
LIGHTY_OPTS="-f /etc/lighttpd/lighttpd.conf"
LIGHTY_NAME=lighttpd
LIGHTY_PIDFILE=/var/run/$LIGHTY_NAME.pid
SCRIPTNAME=/etc/init.d/$LIGHTY_NAME
SSD="/sbin/start-stop-daemon"
PHP_FCGI_CHILDREN=10
PHP_FCGI_MAX_REQUESTS=1000
RETVAL=0

FCGI_DAEMON="/usr/bin/spawn-fcgi"
FCGI_PROGRAM="/usr/bin/php-cgi"
FCGI_PORT="4050"
FCGI_SOCKET="/tmp/php-fastcgi.sock"
FCGI_PIDFILE="/var/run/spawn-fcgi.pid"



Solution 2:
coping this script to your /etc/init.d/lighttpd (if the file is not existing, just create it)

#!/bin/sh

LIGHTTPD_BIN=/usr/local/lighttpd/sbin/lighttpd
test -x $LIGHTTPD_BIN || exit 5
LIGHTTPD_CONFIG=/etc/lighttpd/lighttpd.conf
test -r $LIGHTTPD_CONFIG || exit 6
LIGHTTPD_PIDFILE=/var/run/lighttpd.pid
LIGHTTPD_LOGFILE=/var/log/lighttpd/access.log

case "$1" in
start)
echo "Starting lighttpd"
$LIGHTTPD_BIN -f $LIGHTTPD_CONFIG
;;
stop)
echo "Shutting down lighttpd"
kill `cat $LIGHTTPD_PIDFILE`
;;
restart)
$0 stop
sleep 1
$0 start
;;
force-reload|reload)
echo "Reload service lighttpd"
kill -INT `cat $LIGHTTPD_PIDFILE`
$0 start
touch $LIGHTTPD_PIDFILE
;;
rotate)
echo "Rotate logfile of lighttpd"
mv $LIGHTTPD_LOGFILE /tmp/`date +%D`.log
kill -HUP `cat $LIGHTTPD_PIDFILE`
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|reload|rotate}"
exit 1
;;
esac


and then, typing the command in terminal for your operation you want.

/etc/init.d/lighttpd start

/etc/init.d/lighttpd stop

/etc/init.d/lighttpd restart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值