|
ServerName 192.168.16.252:80 設置主機名 ServerAdmin root@itat.com 管理員郵件地址 DocumentRoot "/www/itat" 主目錄 DirectoryIndex index.html 主頁文件 Errorlog logs/itat/error_log 錯誤日志 Customlog logs/itat/access_log common 訪問日志
AuthType Basic AuthName "This is a security Site,Please Login:" AuthUserFile /etc/httpd/passwd01 Require user root tom </VirtualHost>
2、基于端口的虛擬主機
<VirtualHost *:8081> (*表示本機的所有IP地址) ServerName 192.168.16.254:8081 ...... </VirtualHost>
3、基于多主機頭的虛擬主機(所有站點均應包含在虛擬主機設置中)
a、創(chuàng)建DNS解析結(jié)構 b、創(chuàng)建基于主機頭的虛擬主機
例:NameVirtualHost 192.168.16.254 (設置不同主機頭所公用的IP)
<VirtualHost www.itat.com> (第一個虛擬主機為默認虛擬主機,承擔所有對本 ServerName www.itat.com:80 Apache非指定主機頭的訪問) ServerAdmin root@itat.com DocumentRoot "/www/itat" DirectoryIndex index.html Errorlog logs/itat/error_log Customlog logs/itat/access_log common </VirtualHost>
<VirtualHost www.baidu.com> ServerName www.baidu.com:80 ServerAdmin root@baidu.com DocumentRoot "/www/baidu" DirectoryIndex index.html Errorlog logs/baidu/error_log Customlog logs/baidu/access_log common </VirtualHost> |
【收藏】【打印】【進入論壇】 |
|
|
|
|
|
|
|