apache 2.49配置虚拟主机Forbidden You don't have permission to access / on this server

正常配置方法

1. 打开目录Apache的安装目录/conf/extra/, 找到 httpd-vhosts.conf 文件;
2. 添加一段代码来指定某一域名的网站,如图我配置虚拟域名是:
project.com,文件目录指向的是CI框架;

    ServerAdmin [email protected]
    DocumentRoot "D:/AMP/Apache/htdocs/ci"
    ServerName project.com
    ErrorLog "logs/project.com-error.log"
    CustomLog "logs/project.com-access.log" common

3. 打开 httpd.conf 文件, 添加如下代码:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
如果已存在,将Include前面的#去掉;
4. 重启 Apache 服务,

但是在Apache2.49后不管怎么改都会出现Forbidden  You don't have permission to access / on this server,权限问题

查找之后发现在 httpd-vhosts.conf 中采用如下方式配置即可:

 
    Options Indexes FollowSymLinks  
    AllowOverride all  
    Require all granted  
 
  
 
    DocumentRoot "C:/xxx/xxx"  
    ServerName www.xxx.com  
 

即用

Require all granted  
代替了原来的
Order Allow, Deny  
Allow from all 

无论如何最后好用了,记录一下希望对遇到这个问题的人有帮助!

你可能感兴趣的:(php,web开发,Apache,虚拟主机)