锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
鍩轟簬IP鍦板潃鐨勮櫄鎷熶富鏈洪厤緗?/strong>
Listen 80
DocumentRoot /www/example1
ServerName www.example1.com
DocumentRoot /www/example2
ServerName www.example2.org
鍩轟簬IP鍜屽绔彛鐨勮櫄鎷熶富鏈洪厤緗?/strong>
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鍦板潃鐨勬湇鍔″櫒涓婂熀浜庡煙鍚嶇殑铏氭嫙涓繪満閰嶇疆錛?br />
# 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
鍦ㄥ涓狪P鍦板潃鐨勬湇鍔″櫒涓婇厤緗熀浜庡煙鍚嶇殑铏氭嫙涓繪満錛?br />
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 …
鍦ㄤ笉鍚岀殑绔彛涓婅繍琛屼笉鍚岀殑绔欑偣錛?br />
鍩轟簬澶氱鍙g殑鏈嶅姟鍣ㄤ笂閰嶇疆鍩轟簬鍩熷悕鐨勮櫄鎷熶富鏈恒?br />
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
鍩轟簬鍩熷悕鍜屽熀浜嶪P鐨勬販鍚堣櫄鎷熶富鏈虹殑閰嶇疆:
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