PHP-Apache2.4虚拟目录配置

来源:互联网 发布:淘宝化妆品正品代购 编辑:程序博客网 时间:2024/05/24 02:28

2016年2月15日:

在配置Apache虚拟目录的时候,添加了一个节点如下:

<IfModule dir_module>    #缺省载入页面    DirectoryIndex index.html    #站点别名    Alias  /myblog  "E:/Apache virtual directory/Blog"    <Directory E:/Apache virtual directory/Blog>    #访问权限设置    Order allow,deny    Allow from all    </Directory></IfModule>   

结果报错误1:Invalid command ‘Order’, perhaps misspelled or defined by a module not included in the server configuration。注释掉“Order ... All”这两行代码后依然报错误2:Multiple <Directory> arguments not (yet) supported.

错误1产生原因及解决方法:这是由于版本从2.2升级到2.4。将“Order allow,deny Allow from all”改为“Require all granted”,更多升级详情:http://httpd.apache.org/docs/trunk/upgrading.html

错误2产生原因及解决方法:Directory节点路径中出现空格或者其他格式错误,将其路径用“”括起来即可。

最终代码:

<IfModule dir_module>    DirectoryIndex index.html blog.html    Alias  /myblog  "E:/Apache virtual directory/Blog"    <Directory "E:/Apache virtual directory/Blog">    Require all granted    </Directory></IfModule>   

在浏览器中输入:http://localhost/myblog/blog.html测试。

0 0
原创粉丝点击