无法激活Lighttpd中的用户目录

我正在使用基于Debian 7的主机,并在此主机上configurationPHP-FPM和lighttpd以及rutorrent。 我想使用用户目录而不是默认的/ var / wwwpath。

我已经运行以下命令激活用户目录,但无法使用它们。

root@xxxx# lighty-enable-mod userdir 

还有一件事应该写在/etc/lighttpd/conf-available/10-userdir.conf文件的以下行中; 这样www:// xxxx / project应该指向/ home / user / www / project? 我也在这里使用身份validation,所以user1将看到他的主目录和user2将看到他的主目录。

 userdir.path = "public_html" 

/etc/lighttpd/lighttpd.conf在这里:

 server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", "mod_scgi", ) server.document-root = "/var/www" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd.pid" server.username = "www-data" server.groupname = "www-data" server.port = 80 index-file.names = ( "index.php", "index.html", "index.lighttpd.html$ url.access-deny = ( "~", ".inc" ) static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) compress.cache-dir = "/var/cache/lighttpd/compress/" compress.filetype = ( "application/javascript", "text/css", "text/htm$ # default listening port for IPv6 falls back to the IPv4 port include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port include_shell "/usr/share/lighttpd/create-mime.assign.pl" include_shell "/usr/share/lighttpd/include-conf-enabled.pl" dir-listing.activate = "disable" #disable, so we can enable per directory dir-listing.hide-dotfiles = "enable" dir-listing.exclude = ( "^\~.*$" ) dir-listing.show-readme = "disable" dir-listing.show-header = "disable" dir-listing.hide-readme-file = "disable" dir-listing.hide-header-file = "disable" dir-listing.set-footer = "SeedStorm" 

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 = "public_html" ## The users whose home directories should not be accessible userdir.exclude-user = ( "root", "postmaster" ) 

这实际上说了一切:

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

您可能需要userdir.path = "www" ,但它不能http://xxxx/project映射到/home/user/www/project ,因为它如何知道用户名? mod_userdir不是devise用于mod_auth 。 所以在你的情况下,用户bob将使用http://xxxx/~bob/project来访问~bob/www/project

编辑

内容应该不依赖于authentication(mod_auth); 也许有一天,用户bob想要从用户alice访问一个项目?

取决于授权是好的; 当您授予用户“授权”访问某些数据时,其表示可能会改变。 根据授权,用户可以得到403 Forbidden ,只读访问,(有限)写访问,完成pipe理访问,…

也就是说,您可以使用mod_magnet创build自己的phyiscalpath映射,也可以包含Authorization头中的用户名(参见#2495 )。

鉴于这是强烈的不鼓励,没有“简单”的方法来做到这一点。 configuration中的“variables”在启动时进行评估(检查lighttpd -p -f ...输出),运行时没有“variables” 只有一些模块使用正则expression式匹配中的捕获组提供特殊的模式处理(mod_rewrite,mod_redirect)。

我知道这个线程是旧的,但只是为了日志:

确保public_html文件夹可以被lighttpd读取!

 chmod a+rx /home/$USER/public_html