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

  • 相关阅读:
    微信小程序使用canvas画布实现当前页面截屏并分享
    微信小程序分享转发用法大全——自定义分享、全局分享、组合分享
    小程序条形码插件wxbarcode的使用及改进
    支付宝小程序开发——修改小程序原生radio默认样式
    常用maven配置
    Android Studio 星云常用配置工具箱
    星云最佳实践功法秘籍
    Intellij Idea 星云常用配置工具箱
    那些好用的Chrome 插件
    星云的Linux专用学习手册
  • 原文地址:https://www.cnblogs.com/lit10050528/p/4273844.html
Copyright © 2011-2022 走看看