linux – Lighttpd没有干净地重启(地址已经在使用中)

前端之家收集整理的这篇文章主要介绍了linux – Lighttpd没有干净地重启(地址已经在使用中)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
最近在进行dist-upgrade时,我在Ubuntu 8.0.4上安装的lighttpd-1.4.19已经开始无法使用/etc/init.d/lighttpd restart命令重新启动或重新加载.
~$sudo /etc/init.d/lighttpd restart
 * Stopping web server lighttpd
   ...done.
 * Starting web server lighttpd
2009-06-13 04:06:36: (network.c.300) can't bind to port:  80 Address already in use 
   ...fail!

重新加载时会发生同样的错误.

解决它的方法是杀死lighttpd然后发出启动命令,但似乎我不应该这样做:)

我查看了我的配置文件,无法发现任何即时错误.有没有人有任何想法可能导致此错误?这似乎是写这个问题的最新版本,可以通过apt-get路线获得.

我的配置文件是:

# Debian lighttpd configuration file
# 

############ Options you really have to take care of ####################

## modules to load
# mod_access,mod_accesslog and mod_alias are loaded by default
# all other module should only be loaded if neccesary
# - saves some time
# - saves memory

server.modules              = ( 
            "mod_access","mod_alias","mod_accesslog","mod_compress","mod_fastcgi","mod_rewrite","mod_redirect",)

## a static document-root,for virtual-hosting take look at the 
## server.virtual-* options
server.document-root       = "/var/www/"

## where to send error-messages to
server.errorlog            = "/var/log/lighttpd/error.log"

fastcgi.server = (".PHP" => ((
  "bin-path" => "/usr/bin/PHP5-cgi","socket" => "/tmp/PHP.socket"
)))   

## files to check for if .../ is requested
index-file.names           = ( "index.PHP","index.html","index.htm","default.htm","index.lighttpd.html" )


## Use the "Content-Type" extended attribute to obtain mime type if possible
# mimetype.use-xattr = "enable"

#### accesslog module
accesslog.filename         = "/var/log/lighttpd/access.log"

## deny access the file-extensions
#
# ~    is for backupfiles from vi,emacs,joe,...
# .inc is often used for code includes which should in general not be part
#      of the document-root
url.access-deny            = ( "~",".inc" )

##
# which extensions should not be handle via static-file transfer
#
# .PHP,.pl,.fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".PHP",".pl",".fcgi" )

mimetype.assign             = (
  ".pdf"          =>      "application/pdf",".sig"          =>      "application/pgp-signature",".spl"          =>      "application/futuresplash",".class"        =>      "application/octet-stream",".ps"           =>      "application/postscript",".torrent"      =>      "application/x-bittorrent",".dvi"          =>      "application/x-dvi",".gz"           =>      "application/x-gzip",".pac"          =>      "application/x-ns-proxy-autoconfig",".swf"          =>      "application/x-shockwave-flash",".tar.gz"       =>      "application/x-tgz",".tgz"          =>      "application/x-tgz",".tar"          =>      "application/x-tar",".zip"          =>      "application/zip",".mp3"          =>      "audio/mpeg",".m3u"          =>      "audio/x-mpegurl",".wma"          =>      "audio/x-ms-wma",".wax"          =>      "audio/x-ms-wax",".ogg"          =>      "audio/x-wav",".wav"          =>      "audio/x-wav",".gif"          =>      "image/gif",".jpg"          =>      "image/jpeg",".jpeg"         =>      "image/jpeg",".png"          =>      "image/png",".xbm"          =>      "image/x-xbitmap",".xpm"          =>      "image/x-xpixmap",".xwd"          =>      "image/x-xwindowdump",".css"          =>      "text/css",".html"         =>      "text/html",".htm"          =>      "text/html",".js"           =>      "text/javascript",".asc"          =>      "text/plain",".c"            =>      "text/plain",".conf"         =>      "text/plain",".text"         =>      "text/plain",".txt"          =>      "text/plain",".dtd"          =>      "text/xml",".xml"          =>      "text/xml",".RSS"          =>      "application/RSS+xml",".mpeg"         =>      "video/mpeg",".mpg"          =>      "video/mpeg",".mov"          =>      "video/quicktime",".qt"           =>      "video/quicktime",".avi"          =>      "video/x-msvideo",".asf"          =>      "video/x-ms-asf",".asx"          =>      "video/x-ms-asf",".wmv"          =>      "video/x-ms-wmv",".bz2"          =>      "application/x-bzip",".tbz"          =>      "application/x-bzip-compressed-tar",".tar.bz2"      =>      "application/x-bzip-compressed-tar"
 )

include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

我的/etc/init.d/lighttpd脚本是(未安装):

#!/bin/sh
### BEGIN INIT INFO
# Provides:          lighttpd
# required-Start:    networking
# required-Stop:     networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the lighttpd web server.
### END INIT INFO


PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/lighttpd
NAME=lighttpd
DESC="web server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
SSD="/sbin/start-stop-daemon"

DAEMON_OPTS="-f /etc/lighttpd/lighttpd.conf"

test -x $DAEMON || exit 0

set -e

# be sure there is a /var/run/lighttpd,even with tmpfs
mkdir -p /var/run/lighttpd > /dev/null 2> /dev/null
chown www-data:www-data /var/run/lighttpd
chmod 0750 /var/run/lighttpd

. /lib/lsb/init-functions

case "$1" in
  start)
    log_daemon_msg "Starting $DESC" $NAME
    if ! $ENV $SSD --start --quiet\
    --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
            log_end_msg 1
    else
            log_end_msg 0
    fi
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" $NAME
    if $SSD --quiet --stop --oknodo --retry 30\
    --pidfile $PIDFILE --exec $DAEMON; then
        rm -f $PIDFILE
        log_end_msg 0
    else
        log_end_msg 1
    fi
    ;;
  reload)
    log_daemon_msg "Reloading $DESC configuration" $NAME
    if $SSD --stop --signal 2 --oknodo --retry 30\
    --quiet --pidfile $PIDFILE --exec $DAEMON; then
        if $ENV $SSD --start --quiet  \
        --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
        log_end_msg 0
        else
        log_end_msg 1
        fi
    else
        log_end_msg 1
    fi
  ;;
  restart|force-reload)
    $0 stop
    [ -r  $PIDFILE ] && while pidof lighttpd |\
         grep -q `cat $PIDFILE 2>/dev/null` 2>/dev/null ; do sleep 1; done
    $0 start
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

解决方法

听起来你的“停止”脚本实际上并没有干净地停止服务器.

你可以发布你的/etc/init.d/lighttpd文件吗?

原文链接:https://www.f2er.com/linux/399542.html

猜你在找的Linux相关文章