Apache配置虚拟目录
- 在存放网站的根目录下配置多个子网站文件夹
- 修改Apache的配置文件,设置虚拟目录(在DocumentRoot参数下添加)
1 NameVirtualHost 127.0.0.1 2 <VirtualHost 127.0.0.1> 3 DocumentRoot d:/wamp/www/center 4 ServerName center.bin.com 5 DirectoryIndex index.php 6 </VirtualHost> 7 <VirtualHost 127.0.0.1> 8 DocumentRoot d:/wamp/www/zxllogin 9 ServerName zxllogin.bin.com 10 DirectoryIndex index.php 11 </VirtualHost> 12 <VirtualHost 127.0.0.1> 13 DocumentRoot d:/wamp/www/global-config 14 ServerName config.bin.com 15 DirectoryIndex index.php 16 </VirtualHost>
- 如何在本地上运行,需要配置host文件
- 重启Apache和浏览器即可