问题:
在httpd.conf配置文件中开启了UserDir配置项,并且在系统中创建了一个hadoop用户,在hadoop的家目录下需要创建一个public_html目录,并在目录中创建一个index.html文件,访问时报错,
<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>
解决方法:
最开始一直怀疑是文件权限问题(用户家目录至少要有711权限,用户家目录下的public_html目录至少要有755权限),但是修改文件权限后仍然不行,最后发现是selinux没有关闭造成的,通过setforce 0修改了selinux配置后,问题解决,页面可以正常访问。