apache无权限访问(You don't have permission to access /docs/index.html on this server)

       在ubuntu下用apache配置ext的api,按照网上的教程弄好后会出现访问权限问题 Forbidden You don't have permission to access /docs/index.html on this server,将此问题谷歌百度,问题还是没解决,最后的原因竟然是这样:从硬盘上的其他磁盘拷贝ext文件夹到ubuntu磁盘后,其权限的其他选项的访问权限是“无”,至少将其改成“访问文件”才可以被apache访问

       上面是我遇到问题的解决方案,这里顺便说下用apache配置ext的api的几个步骤:

  • 添加监听端口
    #cd/etc/apache2
    #sudo vim ports.conf
    #监听3800端口,添加下面代码:
    NameVirtualHost*:3800
    Listen 3800
  • 配置目录
    #cd /etc/apache2/sites-enabled
    #在该目录下新建一个文件,名称任取,不需后缀名(如:ext-4.1)
    #sudo gvim  ext-4.1
    #文件内容如下,几个:
    
    <VirtualHost*:3800>
        ServerAdminwebmaster@localhost
    
        DocumentRoot /home/jing/ext-4.1
        <Directory/>
           Options FollowSymLinks
           AllowOverride None
        </Directory>
       <Directory /home/jing/ext-4.1>
           Options Indexes FollowSymLinks MultiViews
           AllowOverride None
           Order allow,deny
            allow fromall
        </Directory>
    
    
       ErrorLog /var/log/apache2/error.log
    
        #Possible values include: debug, info, notice, warn, error, crit,
       # alert, emerg.
        LogLevel warn
    
       CustomLog /var/log/apache2/access.logcombined
    
    </VirtualHost>
  • 重启apache服务器
    sudo /etc/init.d/apache2 restart
原文地址:https://www.cnblogs.com/jing5022/p/3189078.html