开发者社区> cloud_ruiy> 正文

lamp apache配置虚拟主机

简介: You don't have permission to access /index.php on this server directoryIndex  index.html index.php index.
+关注继续查看

You don't have permission to access /index.php on this server

directoryIndex  index.html index.php index.htm index.shtml login.php

/etc/httpd/conf/httpd.conf

解决apache AH01630: client denied by server configuration错误

post by rocdk890 / 2014-4-16 15:58 Wednesday linux技术

  昨天给公司配置了apache-2.4.9的版本,今天他们要求把虚拟主机配置起好放网站程序,在修改apache-2.4.9的配置文件中,我发现了 2.4.x跟以前的2.2.x里面的很多配置都不一样了,比如配置这个虚拟主机都有一些不同,按照以前的配置方法,会报下面的错误:
AH01630: client denied by server configuration: /usr/local/apache/htdocs/recx/

先给大家看看我按照apache-2.2.x配置虚拟机的内容:
NameVirtualHost 192.168.10.81:80

<VirtualHost 192.168.10.81:80>
ServerAdmin rocdk890@gmail.com
directoryIndex  index.html index.php index.htm index.shtml login.php
ServerName 192.168.10.81
DocumentRoot /var/www/vhosts/wwwroot
<Directory "/var/www/vhosts/wwwroot">
    Options -Indexes

    AllowOverride All

    Order allow,deny
    Allow from all

</Directory>
</VirtualHost>

然后下面是apache-2.4.x配置虚拟机的内容:
<VirtualHost 192.168.10.81:80>
ServerAdmin rocdk890@gmail.com
directoryIndex  index.html index.php index.htm index.shtml login.php
ServerName 192.168.10.81
DocumentRoot /var/www/vhosts/wwwroot
<Directory "/var/www/vhosts/wwwroot">
    Options -Indexes

    AllowOverride All

    Require all granted
</Directory>
</VirtualHost>

 

Addons::::apache配置虚拟主机

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /srv/www/example.com/public_html/
    ErrorLog /srv/www/example.com/logs/error.log
    CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@example.org
    directoryIndex  index.html index.php index.htm index.shtml login.php
    ServerName example.org
    ServerAlias www.example.org
    DocumentRoot /srv/www/example.org/public_html/
    ErrorLog /srv/www/example.org/logs/error.log
    CustomLog /srv/www/example.org/logs/access.log combined
</VirtualHost>

调试前后对比

先给大家看看我按照apache-2.2.x配置虚拟机的内容:
NameVirtualHost 192.168.10.81:80

<VirtualHost 192.168.10.81:80>
ServerAdmin rocdk890@gmail.com
directoryIndex  index.html index.php index.htm index.shtml login.php
ServerName 192.168.10.81
DocumentRoot /var/www/vhosts/wwwroot
<Directory "/var/www/vhosts/wwwroot">
    Options -Indexes

    AllowOverride All

    Order allow,deny
    Allow from all

</Directory>
</VirtualHost>

然后下面是apache-2.4.x配置虚拟机的内容:
<VirtualHost 192.168.10.81:80>
ServerAdmin rocdk890@gmail.com
directoryIndex  index.html index.php index.htm index.shtml login.php
ServerName 192.168.10.81
DocumentRoot /var/www/vhosts/wwwroot
<Directory "/var/www/vhosts/wwwroot">
    Options -Indexes

    AllowOverride All

    Require all granted
</Directory>
</VirtualHost>

 

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
Centos7下多种方式配置 Apache虚拟主机
Centos7下多种方式配置 Apache虚拟主机
117 0
给Apache虚拟主机增加端口的方法
给Apache虚拟主机增加端口的方法
28 0
Apache配置虚拟主机
Apache配置虚拟主机
69 0
Apache虚拟主机配置详细教程
Apache虚拟主机配置详细教程
142 0
RH358配置Web服务器--使用 Apache HTTPD 对虚拟主机进行配置和故障排除
RH358配置Web服务器--使用 Apache HTTPD 对虚拟主机进行配置和故障排除
78 0
Apache 单IP配置多个HTTPS虚拟主机
Apache 文档中提到,不能在单个 IP上同时有多个按名字识别的虚拟主机("named virtual host"),其实不完全是这样了。 使用SNI SNI全称Server Name Indication(服务器名称指示),这个问题可以解决apache中的单IP多HTTPS虚拟主机,只有默认第一个站点的SSL生效的问题。但是这些技术需要浏览器的版本支持
483 0
Linux指令之Apache虚拟主机配置
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/w1lgy/article/details/80388697 1、安装Apache...
1201 0
+关注
cloud_ruiy
爱技术,爱开源,爱linux! 在技术成长道路上,能拉一把就拉一把,不藏着不掖着! 我由衷希望能和有理想敢吃苦的it人一起共同进步,共同成长! 虽然我现在没有大牛的能力,但是我有大牛的心态. 技术领域:shell编程,C编程,嵌入式开发.hadoop大数据,桉树,onenebul
文章
问答
文章排行榜
最热
最新
相关电子书
更多
贺小令|Apache Flink 1.16 简介
立即下载
Apache Dubbo3 源码深入解读
立即下载
Apache Dubbo 微服务开发从入门到精通
立即下载