您的位置:首页 > 运维架构 > Apache

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

2017-03-22 17:49 405 查看
升级到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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: