apache 2.4-X版本配置虚拟主机

来源:互联网 发布:mysql 自增 编辑:程序博客网 时间:2024/06/05 16:34
升级到apache2.4以上的版本时,其配置和之前的略有不同。
比如 ,配置虚拟主机的过程:
1.httpd.conf 文件开启虚拟主机配置文件加载
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

2.在extra/httpd-vhosts.conf配置文件中配置虚拟主机
#www目录下的虚拟主机
<VirtualHost *:80>
    DocumentRoot "D:\wamp\wamp\www"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:\Users\Administrator\Desktop\testgit"
    ServerName www.testcrm.com
</VirtualHost>

3.此时,如果访问第二个虚拟主机是没有权限的。因为在httpd.conf中已禁用了其它目录的访问权限,此时只需在httpd.conf中找到
<Directory />
    AllowOverride none
    Require all denied   #改为granted即可
</Directory>

更多的配置详情:http://httpd.apache.org/docs/
0 0
原创粉丝点击