如何配置自己的虛擬主機(jī)
配置全局虛擬主機(jī):1、在conf/httpd.conf文件中啟用# Virtual hosts 配置虛擬主機(jī)Include conf/extra/httpd-vhosts.conf改服務(wù)即把Inclu
配置全局虛擬主機(jī):
1、在conf/httpd.conf文件中啟用
# Virtual hosts 配置虛擬主機(jī)
Include conf/extra/httpd-vhosts.conf
改服務(wù)即把Include conf/extra/httpd-vhosts.conf前#號(hào)刪除
2、在conf/extra/httpd-vhosts.conf文件中添加如下代碼。
#配置自己的虛擬主機(jī)
DocumentRoot "E:/myweb/apache/htdocs"
#這里配置歡迎首頁面
DirectoryIndex index.html index.php index.htm
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
3、在C盤系統(tǒng)盤中的C:WINDOWSsystem32driversetchosts文件增加如下代碼
127.0.0.1 myweb.com
127.0.0.1 myweb.com表示url地址欄中的域名將映射到127.0.0.1這個(gè)ip地址上
4、重啟apache服務(wù)
配置單目錄單域名虛擬主機(jī):
1、打開conf/httpd.conf文件將以下代碼插入。
DocumentRoot "D:/Zend/htdocs/test"
ServerName www.test.com
DirectoryIndex index.html index.php index.htm
2、在C盤系統(tǒng)盤中的C:WINDOWSsystem32driversetchosts文件增加如下代碼
127.0.0.1 www.test.com
127.0.0.1 www.test.com表示url地址欄中的域名將映射到127.0.0.1這個(gè)ip地址上
3、重啟apache服務(wù)