Project

General

Profile

So this error log permissions problem seems to be very common: is there a documented fix?

Added by paulbeard over 10 years ago

I'm one of many faced with this:

2013-11-22 16:17:27: (log.c.118) opening errorlog '/var/log/lighttpd/error.log' failed: Permission denied

and no idea how to fix it. Permissions look fine, the file exists, is owned by the www user in the www group.

Operating System (OS) you are using (Linux (which distro?), FreeBSD, Solaris, etc.) + version

FreeBSD x.x.x 8.4-STABLE FreeBSD 8.4-STABLE #2 r256307M: Sat Oct 12 00:23:20 PDT 2013     root@x.x.x:/usr/obj/usr/src/sys/SHUTTLE  i386

Version of Lighttpd
lighttpd/1.4.33 (ssl) - a light and fast webserver
Build-Date: Nov 21 2013 21:37:58

Configuration you are using (you can use a nopaste service like http://paste.lighttpd.net or inline your config into your post using the "C" or "pre" buttons in the text form)
var.log_root    = "/var/log/lighttpd" 
var.server_root = "/usr/local/www" 
var.state_dir   = "/var/run" 
var.home_dir    = "/var/spool/lighttpd" 
var.conf_dir    = "/usr/local/etc/lighttpd" 
var.vhosts_dir  = server_root + "/vhosts" 
var.cache_dir   = "/var/cache/lighttpd" 
var.socket_dir  = home_dir + "/sockets" 
include "modules.conf" 
server.port = 8888
server.username  = "www" 
server.groupname = "www" 
server.document-root = "/usr/local/www/" 
server.pid-file = state_dir + "/lighttpd.pid" 
server.errorlog             = log_root + "/error.log" 
include "conf.d/access_log.conf" 
include "conf.d/debug.conf" 
server.event-handler = "freebsd-kqueue" 
server.network-backend = "writev" 
server.max-fds = 2048
server.stat-cache-engine = "simple" 
server.max-connections = 1024
index-file.names += (
  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php" 
)
url.access-deny             = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable" 
}
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
include "conf.d/mime.conf" 
include "conf.d/dirlisting.conf" 
server.follow-symlink = "enable" 
server.upload-dirs = ( "/var/tmp" )

What client you used (Browser, curl, etc.)
Never got that far.
ls -ltr /var/log/ | grep ttpd
drw-r--r--  2 root    wheel    374272 Nov 22 00:00 httpd
drwxr-xr-x  2 www     www         512 Nov 22 16:11 lighttpd

 ls -ltr /var/log/lighttpd/
total 8
-rw-r--r--  1 www  www  213 Nov 22 15:49 access.log
-rw-r--r--  1 www  www  508 Nov 22 15:54 error.log

I can log to files in /tmp so it's the log file location that's the problem.

Ideally, this would be part of the installation: the log directory is created already but it would be a lot more useful if you could, you know, use it. Postfix has a permissions checker/fixer as part of it's installation. Considering how many results I found when I searched for (log.c.118) opening errorlog it's not just me.