zoukankan      html  css  js  c++  java
  • Linux中访问Apache报403错误处理方法

    1、先说本地环境,脱离基础环境的解决策略都是耍流氓

          (1)Linux:CentOS7.5

          (2)Apache: Apache/2.4.6 (CentOS)

          (3)Apache的安装路径在 /usr/local/httpd2.4

    2、出现错误

        按照正常的流程解压Apache包并完成配置,正常启动,启动后,输入访问URL:http://IP:端口/,很不幸页面出现403Forbidden错误。You don't have permission to access / on this server。

    3、解决措施

        (1) 首先是修改/home/project/soft/apache/conf/httpd.conf。找到<Directory />,并将里面的内容修改如下:

    <Directory />
        AllowOverride all
        Require all granted
    </Directory>

      (2)此时如果重启Apache服务,发现仍然是无法访问,但是页面报错增加了一行内容“Server unable to read htaccess file, denying access to be safe”。此时要会去查看Apache的日志。(Apache安装路径下log/error_log),发现里面有报错信息:Fri Sep 28 16:33:22.661903 2018] [core:crit] [pid 16685:tid 139887686231808] (13)Permission denied: [client 172.16.40.224:50470] AH00529: /home/project/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/project/' is executable。按照报错提示,在/home/project下建立文件.htaccess,并在文件中输入以下内容:

    Order allow,deny
    Allow from all
    Require all granted


    保存并退出。

    (3)此时可以直接重启Apache并尝试方式是否正常,如果不正常,再执行以下步骤:

    chmod 755 /home/project

    (4)上述步骤全部执行完后,应该可以正常访问了。

  • 相关阅读:
    3D标签云
    IntelliJ IDEA 13.1.1版本偶然的错误
    414. Third Maximum Number
    217. Contains Duplicate
    442.Find All Duplicates in an Array
    3D轮播图
    448. Find All Numbers Disappeared in an Array
    Beautifulsoup模块
    MySQL数据库
    常用模块
  • 原文地址:https://www.cnblogs.com/xuezhihen1901/p/10662341.html
Copyright © 2011-2022 走看看