Install config: lighttpd dead but pid file exists

I’m trying to run rails on RHED (centos 4) by following this tutorial:

and something is gone a bit astray during the install process that is
not allowing lighttpd \ apache to run rails on the web.

Since i’m running Centos, I should mention I’m NOT running SELinux.

As it is, i’m at a total loss as to why this is not working: I’ve
created my init app (admin) with the correct path. The public folder
has the dispatch.fcgi. All the logs are correctly located, as is the
pid yet STILL when I run:

[[email protected] lighttpd]# service lighttpd start
Starting lighttpd: [ OK ]

I get:

[[email protected] lighttpd]# service lighttpd status
lighttpd dead but pid file exists

Could anyone tell me why lighttpd won’t light up!?

Here is my lighttpd.conf for your consideration:

server.document-root = “/home/www/web4/web/admin/”

where to send error-messages to

server.errorlog = “/var/log/lighttpd/error_log.log”

files to check for if …/ is requested

server.indexfiles = ( “index.php”, “index.html”,
“index.htm”, “default.htm” )

server.error-handler-404 =

server.port = 8080

to help the rc.scripts = “/var/run/”

change uid to (default: don’t care)

server.username = “lighttpd”

change uid to (default: don’t care)

server.groupname = “lighttpd”

fastcgi.server = (
“.fcgi” => (
“rails” => (
“socket” => “/tmp/lighttpd-fcgi.socket”,
“bin-path” =>
“bin-environment” => ( “RAILS_ENV” =>
“production” ),
“min-procs” => 2,
“max-procs” => 2


I cant see any problems with your setup.

I’d suggest you go on a hunt for clues.

-Can you start webrick?
-Can you start lightppd directly from the shell?
-Can you find the appropriate log files and see anything
interesting in them?

I’m interested in helping you because I’m thinking about setting
up a Centos box which would be well suited for me using Oracle
as the DB.


It appears that lighttpd won’t run without being able to write to the
access\error log.

I set up my logs (using vi) and when I try to start lighttpd manually I

[[email protected] log]# /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
2006-09-07 15:39:39: (log.c.60) opening errorlog
‘/home/www/web4/web/admin/log/lighttpd_error.log’ failed: Permission
2006-09-07 15:39:39: (server.c.654) opening errorlog failed, dying

I tried to chmod the perms to 777 to allow lightly to write to the file
but no luck!

Does anyone know whats going on?



it looks like you have bumped into a pretty good clue.

If the chmod 777 did not work on the file,
I’d rm the file and take a very close look at the directories.

Also I’d make sure that the owner of the lighttpd process,
is the same id of the directories.

Also check if lighttpd is happy if you configure it
so that the logs live in /tmp.

I know that is not a good place for them permanently but
lighttpd should be able to write there.

Also I’ve never used vi to create log files.
Instead, I just made sure that lighttpd could write in
the log directories and I let it do what it wants.

Also, if you are starting lighttpd
straight from the command line,
and you do it as root,
you might have problems writing to
any directory which lives on another machine
but is shared to you via NFS.

If you type

df /home/www/web4/web/admin/log
You will find out if that directory is local or
on NFS.


I am still not getting any luck getting lighttpd installed and started

I can determine that webrick is running fine in the console:

[[email protected] admin]# script/server webrick -p 3000
=> Booting WEBrick…
=> Rails application started on
=> Ctrl-C to shutdown server; call with --help for options
[2006-09-07 09:12:04] INFO WEBrick 1.3.1
[2006-09-07 09:12:04] INFO ruby 1.8.4 (2005-12-24) [i386-linux]
[2006-09-07 09:12:04] INFO WEBrick::HTTPServer#start: pid=21344

however, when I try to start lighttpd I get the following:

[[email protected] admin]# service lighttpd start
Starting lighttpd: [ OK ]
[[email protected] admin]# service lighttpd status
lighttpd dead but pid file exists

Worse yet, I can find nothing that details the meaning of “lighttpd
dead but pin file exists”. Does anyone know why lighttpd is failing in
this way? The documentation on ROR says that perhaps the conf has some
paths incorrect. I’ve checked and double checked. Included herein is
the complete lighttpd.conf file. Perhaps you guys can see what I’m

The app is running in /home/www/web4/web/admin, where admin is the
rails app. (using vhosts here).

The one thing I’m not able to see is the error logs for lighttpd, which
contain no info.

Would love to get started with ROR here but need to get the damn
thing running. Dan, centOS has been quite nice for a RHED clone.
We’re using as a test box to mirror our prod box and its gone quite


p.s. here is my lighttpd.conf

lighttpd configuration file

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

modules to load

server.modules = (
“mod_accesslog” )

a static document-root, for virtual-hosting take look at the

server.virtual-* options

server.document-root = “/home/www/web4/web/admin/public/”

where to send error-messages to

#server.errorlog = “/var/log/lighttpd/error_log.log”

server.errorlog =

files to check for if …/ is requested

server.indexfiles = ( “index.php”, “index.html”,
“index.htm”, “default.htm” )

mimetype mapping

mimetype.assign = (
“.rpm” => “application/x-rpm”,
“.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” => “application/ogg”,
“.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”,
“.cpp” => “text/plain”,
“.log” => “text/plain”,
“.conf” => “text/plain”,
“.text” => “text/plain”,
“.txt” => “text/plain”,
“.dtd” => “text/xml”,
“.xml” => “text/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”

Use the “Content-Type” extended attribute to obtain mime type if

#mimetype.use-xattr = “enable”

send a different Server: header

be nice and keep it at lighttpd

#server.tag = “lighttpd”

accesslog module

#accesslog.filename = “/var/log/lighttpd/access_log.log”

accesslog.filename =

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


$HTTP[“url”] =~ “.pdf$” {
server.range-requests = “disable”

######### Options that are good to be but not neccesary to be changed

bind to port (default: 80)

server.port = 8080

bind to localhost (default: all interfaces)

#server.bind = “
#server.bind = “”

error-handler for status 404

#server.error-handler-404 = “/error-handler.html”
#server.error-handler-404 = “/error-handler.php”

NOTE: here I went with documentation instead of where its located

#server.error-handler-404 =
server.error-handler-404 = “/dispatch.fcgi”

to help the rc.scripts = “/var/run/”

virtual hosts

If you want name-based virtual hosting add the next three settings

and load


document-root =

virtual-server-root + virtual-server-default-host +



virtual-server-root + http-host + virtual-server-docroot

#simple-vhost.server-root = “/home/weigon/wwwroot/servers/”
#simple-vhost.default-host = “
#simple-vhost.document-root = “/pages/”

simple-vhost.server-root = “/home/www/web4/www/”
simple-vhost.default-host = “
simple-vhost.document-root = “/admin/”

Format: .html

-> …/status-404.html for ‘File not found’

#server.errorfile-prefix =

virtual directory listings

#server.dir-listing = “enable”

enable debugging

#debug.log-request-header = “enable”
#debug.log-response-header = “enable”
#debug.log-request-handling = “enable”
#debug.log-file-not-found = “enable”

only root can use these options

chroot() to directory (default: no chroot() )

#server.chroot = “/”

change uid to (default: don’t care)

server.username = “lighttpd”

change uid to (default: don’t care)

server.groupname = “lighttpd”

compress module

#compress.cache-dir = “/tmp/lighttpd/cache/compress/”
#compress.filetype = (“text/plain”, “text/html”)

proxy module

read proxy.txt for more info

#proxy.server = ( “.php” =>

( “localhost” =>


“host” => “”,

“port” => 80




fastcgi.server = (
“.fcgi” => (
“rails” => (
“socket” => “/tmp/lighttpd-fcgi.socket-0”,
“bin-path” =>
“bin-environment” => ( “RAILS_ENV” =>
“production” ),
“min-procs” => 2,
“max-procs” => 2

CGI module

#cgi.assign = ( “.pl” => “/usr/bin/perl”,

“.cgi” => “/usr/bin/perl” )

SSL engine

#ssl.engine = “enable”
#ssl.pemfile = “server.pem”

status module

#status.status-url = “/server-status”
#status.config-url = “/server-config”