2

I am using Debian 7 64 as host, And i installed Lighttpd and PHP-FPM with mysql support, After fresh installation of lighttpd and PHP-FPM, I tried to enable user directories and i run following command:

root@x.x.x.x# lighty-enable-mod userdir

I got Ok messege after run above command but when i run below command to restart lighttpd, i got following output:

root@x.x.x.x# /etc/init.d/lighttpd force-reload
[FAIL] Reloading web server configuration: lighttpd failed!

I wants to open /home/user/www/project_name; when someone open my site; Like this way : www.mysite.com/project_name, so I did following changes on /etc/lighttpd/conf-available/10-userdir.conf

## The userdir module provides a simple way to link user-based directories into
## the global namespace of the webserver.
##
# /usr/share/doc/lighttpd/userdir.txt

server.modules      += ( "mod_userdir" )

## the subdirectory of a user's home dir which should be accessible
## under http://$host/~$user
userdir.path         = "/www/project_name/public_html"

## The users whose home directories should not be accessible
userdir.exclude-user = ( "root", "postmaster" )

Following is the output of /var/log/lighttpd/error.log file.

2013-09-29 10:25:57: (log.c.166) server started 2013-09-29 10:44:57: (server.c.1430)     [note] graceful shutdown started 
2013-09-29 10:44:57: (log.c.166) server started 
2013-09-29 10:44:57:(mod_fastcgi.c.977) bind failed for: unix:/var/run/php5-fpm.sock-0 Permission denied         
2013-09-29 10:44:57: (mod_fastcgi.c.1397) [ERROR]: spawning fcgi failed. 
2013-09-29 10:44:57: (server.c.964) Configuration of plugins failed. Going down. 
2013-09-29 10:44:57: (server.c.1546) server stopped by UID = 0 PID = 5841 
2013-09-29 12:59:58: (log.c.166) server started 
2013-09-29 12:59:58: (mod_fastcgi.c.977) bind failed for: unix:/var/run/php5-fpm.sock-0 Permission denied         
2013-09-29 12:59:58: (mod_fastcgi.c.1397) [ERROR]: spawning fcgi failed. 
2013-09-29 12:59:58: (server.c.964) Configuration of plugins failed. Going down.

I cant fix problem and looking for solution.

Pradeep Gupta
  • 387
  • 2
  • 5
  • 18

1 Answers1

1

lighttpd cannot write in /var/run, and binding to a unix socket always create a new file (changing permissions on a already existing one doesn't help).

/var/run is not /tmp - only root should be able to write. use a directory that is owned by lighttpd if you want lighttpd to create socket files (/tmp is also a bad idea!)

Also it looks like you're using php-fpm: you can't spawn php-fpm from lighttpd, remove the "bin-path" option. php-fpm is usually spawned through init scripts (or similar), and creates the sockets for each user it spawns php backends for (each user gets its own socket).

Stefan
  • 859
  • 1
  • 7
  • 18
  • I Understand to create new directories owned by lighttpd, I think www-data is the user who has permission to write behalf of lighttpd, But i cant understand second para in which you describe php-fpm, can you elaborate this more? – Pradeep Gupta Sep 30 '13 at 09:44
  • 1
    removal of "bin-path" from 15-fastcgi-php.conf worked for me. However /var/run/php5-fpm.sock still work for me. Thanks by the way. – Pradeep Gupta Sep 30 '13 at 10:46
  • php-fpm runs as root, so it is able to create sockets in `/var/run/`. – Stefan Sep 30 '13 at 12:59