zoukankan      html  css  js  c++  java
  • Apache: You don't have permission to access / on this server

    当我们需要使用Apache配置虚拟主机时,有可能会出现这个问题:Apache: You don't have permission to access / on this server

    # 同IP不同域名
    # Listen for virtual host requests on all IP addresses
    NameVirtualHost *:8080
    
    <VirtualHost *:8080>
    DocumentRoot "D:/lamp/phpweb/full"
    ServerName full.thinkphp.com
    </VirtualHost>
    
    <VirtualHost *:8080>
    DocumentRoot "D:/lamp/core"
    ServerName core.thinkphp.com
    # Other directives here
    </VirtualHost>
    
    <Directory "D:/lamp/core">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    我们使用上面的配置来实现基于不同域名的多站点配置,如果我不添加最后一段红色字体的部分,就会出现上面的问题,因为这部分的意思是

    #
    # Each directory to which Apache has access can be configured with respect
    # to which services and features are allowed and/or disabled in that
    # directory (and its subdirectories). 
    #
    # First, we configure the "default" to be a very restrictive set of 
    # features.  
    #
    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>

    这是Apache配置文件中的一段,大概意思就是'每一个Apache有权限访问的目录都需要配置,指定那个目录下的哪个服务是被允许的或者不被允许的',而默认是不能被访问的。

    这里就找到了上面那个问题的原因了,如果我没有添加那段红色的字体部分,就表示,那个目录是不被允许访问的,所以就出现403错误。

    注意:为什么第一个域名就不需要配置,那是因为,它放在'ServerRoot'目录下,所以是允许访问的。而第二个目录不在'ServerRoot'目录下,所以需要另外指定它允许的权限。

  • 相关阅读:
    python xlwt 设置单元格样式-合并单元格
    Ubuntu 16.04配置国内高速apt-get更新源
    python3.5 安装python3-tk
    m4a 转 wav
    hmm前后向算法
    hmm三个问题
    veterbi
    马尔科夫和隐马尔科夫
    Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ma ven/cli/Maven/java与javac版本不一致问题
    spring 配置定时任务
  • 原文地址:https://www.cnblogs.com/lit10050528/p/4273844.html
Copyright © 2011-2022 走看看