虛擬主機的配置
基於ip位址的虛擬主機配置
listen 80
documentroot /www/example1
servername www.example1.com
documentroot /www/example2
servername www.example2.org
基於ip和多埠的虛擬主機配置
listen 172.20.30.40:80
listen 172.20.30.40:8080
listen 172.20.30.50:80
listen 172.20.30.50:8080
documentroot /www/example1-80
servername www.example1.com
documentroot /www/example1-8080
servername www.example1.com
documentroot /www/example2-80
servername www.example1.org
documentroot /www/example2-8080
servername www.example2.org
單個ip位址的伺服器上基於網域名稱的虛擬主機配置:
# ensure that apache listens on port 80
listen 80
# listen for virtual host requests on all ip addresses
namevirtualhost *:80
documentroot /www/example1
servername www.example1.com
serveralias example1.com. *.example1.com
# other directives here
documentroot /www/example2
servername www.example2.org
# other directives here
在多個ip位址的伺服器上配置基於網域名稱的虛擬主機:
listen 80
# this is the 「main」 server running on 172.20.30.40
servername server.domain.com
documentroot /www/mainserver
# this is the other address
namevirtualhost 172.20.30.50
documentroot /www/example1
servername www.example1.com
# other directives here …
documentroot /www/example2
servername www.example2.org
# other directives here …
在不同的埠上執行不同的站點:
基於多埠的伺服器上配置基於網域名稱的虛擬主機。
listen 80
listen 8080
namevirtualhost 172.20.30.40:80
namevirtualhost 172.20.30.40:8080
servername www.example1.com
documentroot /www/domain-80
servername www.example1.com
documentroot /www/domain-8080
servername www.example2.org
documentroot /www/otherdomain-80
servername www.example2.org
documentroot /www/otherdomain-8080
基於網域名稱和基於ip的混合虛擬主機的配置:
listen 80
namevirtualhost 172.20.30.40
documentroot /www/example1
servername www.example1.com
documentroot /www/example2
servername www.example2.org
documentroot /www/example3
servername www.example3.net
apache虛擬主機配置
之前已經在csdn上上傳過apache的文件在這裡補充說明一下,apache2.2.x與tomcat或iis或三者之間的虛擬主機配置。介紹一下如何整合其他 web伺服器,如 iis tomcat 等。網上有 n多整合方案講的都不是很清楚 特別是 windows 下的 這裡要特別提示一下,apache...
apache虛擬主機配置
多個網域名稱 伺服器 對應乙個 ip 位址,配置方法為 namevirtualhost 111.22.33.44 servername www.sample.com documentroot www sample servername www.sample2.com documentroot www...
apache配置虛擬主機
namevirtualhost 80 directoryindex default.php index.html index.php index.htm servername www.host1.com servername host1 com documentroot d wamp www1 er...