我使用 Debian 7 64 作为主机,并安装了支持 mysql 的 Lighttpd 和 PHP-FPM,全新安装 lighttpd 和 PHP-FPM 后,我尝试启用用户目录并运行以下命令:
[email protected]# lighty-enable-mod userdir
运行上面的命令后我得到了 Ok messege,但是当我运行下面的命令重新启动 lighttpd 时,我得到以下输出:
[email protected]# /etc/init.d/lighttpd force-reload
[FAIL] Reloading web server configuration: lighttpd failed!
我想打开 /home/user/www/project_name; 当有人打开我的网站时;像这样:www.mysite.com/project_name,所以我在 /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" )
以下是 /var/log/lighttpd/error.log 文件的输出。
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.
我无法解决问题并寻找解决方案。
lighttpd 无法写入
/var/run
,并且绑定到 unix 套接字总是会创建一个新文件(更改现有文件的权限无济于事)。/var/run
不是/tmp
- 只有 root 应该能够写入。如果您希望 lighttpd 创建套接字文件,请使用 lighttpd 拥有的目录(/tmp
这也是一个坏主意!)此外,您似乎正在使用 php-fpm:您无法从 lighttpd 生成 php-fpm,请删除“bin-path”选项。php-fpm 通常通过 init 脚本(或类似脚本)生成,并为每个用户创建套接字,并为其生成 php 后端(每个用户都有自己的套接字)。