• 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'目录下,所以需要另外指定它允许的权限。

  • 相关阅读:
    高效算法——D 贪心,区间覆盖问题
    高效算法——C 分饼
    高效算法——A 归并排序
    高效算法——Most financial institutions 贪心 H
    高效算法——E
    高效算法——Bin Packing F
    POJ2192
    UVa11584
    POJ2429
    POJ1811- Prime Test(Miller–Rabin+Pollard's rho)
  • 原文地址:https://www.cnblogs.com/lit10050528/p/4273844.html
Copyright © 2020-2023  润新知