我在Fedora Workstation 24上运行Apache。我有一个用户" foo",目录" public_html",以及该目录中的index.html文件。
我希望能够向localhost/~foo
发出请求并提供html文件。目前我找不到404。
用于install / config和相关文件的命令:
dnf install httpd
chmod 711 ~foo
chmod 755 ~foo/public_html
systemctl start httpd
来自/etc/httpd/conf.d/userdir.conf
:
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
# UserDir disabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "/home/*/public_html">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Require method GET POST OPTIONS
</Directory>
索引文件:/home/foo/public_html/index.html是世界可读的。
为什么这会产生404的任何想法?我可以访问localhost/
。由于我没有收到403,我假设这不是权限错误。