Apache 用户的目录及文件无法访问(fedora 7)(已解决)

Apache 用户的目录及文件无法访问(fedora 7)(已解决)

我配置了一台WEB服务器,访问http://localhost/index.html能行,但是http://localhost/~用户/public_html/index.html却无法访问。
错误如下:You don't have permission to access /~lilayin/public_html/index.html on this server.
在配置的时候我设置的权限chmod 711 用户  , chmod 755 用户/public_html.
httpd.conf中UserDir中配置提示如下:

        # 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.
        #
        # See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
        #
        <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 disable

            #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disable" line above, and uncomment
    # the following line instead:
            #
      UserDir public_html

        </IfModule>

        <Directory /home/*/public_html>
            AllowOverride FileInfo AuthConfig Limit
            Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
            <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
            </Limit>
            <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
        </Directory>
不知道错没有。
在查看SElinux有如下信息
        SELinux has denied /usr/sbin/httpd access to potentially mislabeled file(s) (public_html). This means that SELinux will not allow /usr/sbin/httpd to use these files. It is common for users to edit files in their home directory or tmp directories and then move (mv) them to system directories. The problem is that the files end up with the wrong file context which confined applications are not allowed to access.
        If you want /usr/sbin/httpd to access this files, you need to relabel them using restorecon -v public_html. You might want to relabel the entire directory using restorecon -R -v .
          最后那点看不懂到底要做什么才行。
        望大家指点一下

看样子是SELinux禁止apache访问public_html了。

如果是开发用的服务器,把SELinux禁止就行了。
有图形界面就从图形界面里关掉
没有的话,好像是改 /etc/selinux/ 下面的某个文件,
按照里面的注释改好了,重启即可。

要是正式服务器,对不起,找个懂SELinux的人来吧。
实在不行就按照错误信息中给出的建议
# restorecon -R -v public_html
看来楼上的对linux有一定的了解呀,一下就看出来我的用意了,最近我在学WEB编程学校却教ASP,ASP都过时了我没想去学他,于是从IBM的网站上下了个PHP JAVA的集成开发环境,在我的用户目录里开发WEB,可是就是不能访问那个目录,配置 apache始终有问题,SELinux我还不太了解,看了你的提示,现在能访问那个目录了就是在其目录下的index.html文件却不能发现,有好心人帮下呀,感之不尽!
  The requested URL /~lilayin/public_html/index.html was not found on this server.
晕我犯了个低级失误不该用http://localhost/~用户/public_html/index.html 而该用http://localhost/~用户/index.html