【发布时间】:2016-07-15 01:14:53
【问题描述】:
我正在尝试让用户目录在 Arch Linux 上使用 Lighttpd。但是在创建 public_html 目录、在其中放置一个 index.html 文件、设置权限、配置 Lighttpd 以使用用户目录模块并重新启动 lighttpd 之后,它仍然为一个特定用户提供 404(另一个有效)。
这是我的配置文件:
$ cat /etc/lighttpd/lighttpd.conf
# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions
server.port = 80
server.username = "http"
server.groupname = "http"
server.document-root = "/srv/http"
server.errorlog = "/var/log/lighttpd/error.log"
dir-listing.activate = "enable"
index-file.names = ( "index.html" )
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".css" => "text/css",
".js" => "application/x-javascript",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".gif" => "image/gif",
".png" => "image/png",
"" => "application/octet-stream"
)
include "conf.d/userdir.conf"
include "conf.d/cgi.conf"
$ cat /etc/lighttpd/conf.d/userdir.conf
server.modules += ( "mod_userdir" )
userdir.path = "public_html"
这就是用户 aardbei 的样子:
$ cat /home/aardbei/public_html/index.html
doot doot
$ ls -ld /home/aardbei/public_html
drwxrwxrwx 2 aardbei aardbei 4096 Mar 27 13:10 /home/aardbei/public_html
$ ls -ld /home/aardbei/public_html/index.html
-rwxrwxrwx 1 aardbei aardbei 37 Mar 27 13:11 /home/aardbei/public_html/index.html
但即使在使用 sudo systemctl restart lighttpd 重新启动服务器后,我仍然在 URI /~aardbei/index.html 处得到 404,而不是我应该得到的:“doot doot”
但是,这就是用户madeline的样子:
$ cat /home/madeline/public_html/index.html
blah blah blah
$ ls -ld /home/madeline/public_html/
drwxrwxrwx 19 madeline madeline 4096 Mar 27 13:33 /home/madeline/public_html/
$ ls -ld /home/madeline/public_html/index.html
-rw-r--r-- 1 madeline madeline 15 Mar 27 13:33 /home/madeline/public_html/index.html
所以重要的部分是相同的。然而,去 URI /~madeline/index.html 做了它应该做的事情:它显示“blah blah blah”
这里看起来没有什么相关的,但这里是两个用户的组:
$ groups madeline
wheel video audio wireshark madeline
$ groups aardbei
wheel aardbei
发生了什么事?为什么用户 aardbei 的用户目录在 Lighttpd 中不起作用?
【问题讨论】:
标签: permissions directory http-status-code-404 lighttpd