小枫客栈

淡泊以明志,宁静以致远!

« 常见黑客术语大词典常见电子商务网络安全问题及解决方案 »

在Apache中配置多个虚拟主机

为作本地测试及同时使用花生壳
网络上搜索并整理了一下配置apache虚拟主机的方法
测试环境 :Windows  apache2.2
主要用于个人在本地使用不同的ip或者端口 创建多个虚拟主机
修改httpd.conf文件 Listen 80
Listen 8080
Listen 12345
以上表示使用80、8080和12345端口,当然这些都是自定的
据说以127开头的ip全部指向本地,测试了一下貌似有这么回事 如127.1.2.3 <VirtualHost *:8080>
DocumentRoot "D:\web/html"
ServerName *:8080
</VirtualHost>
<Directory "D:\web/html">
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
以上表示当访问http://ip:8080时 调用的根目录路径为  D:\web\html 方法二:
<VirtualHost 127.0.0.2>
DocumentRoot "D:\web/html"
ServerName 127.0.0.2
</VirtualHost>
<Directory "D:\web/html">
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory> <VirtualHost 127.0.0.3:8080>
DocumentRoot "D:\web/html"
ServerName 127.0.0.3:8080
</VirtualHost>
<Directory "D:\web/html">
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
其实原理大致相同,具体的环境采用合适的配置方法即可

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Copyright © 2006 - 2012 Xiaofeng. All Rights Reserved.
豫ICP备07012919号