http://www.kingmx.com/Manual/ApacheMenu/index.html
基于主机名的虚拟主机(一个IP地址,多个网站)
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>
http://www.kingmx.com/Manual/ApacheMenu/vhosts/examples.html
域名访问--->Apache:80,根据域名重写url --->tomcat:81/82...
<VirtualHost *:80>
ServerAdmin cc@cc.com
DocumentRoot "D:/Tomcat 5.0/webapps/ROOT"
ServerName cc.com, *.cc.com
ErrorLog logs/cc.com-error_log
CustomLog logs/cc.com-access_log common
ProxyPass / http://127.0.0.1:81/
ProxyPassReverse / http://127.0.0.1:81/
</VirtualHost>
<VirtualHost *:80>
ServerAdmin zzyy@zzyy.com
DocumentRoot "D:/Tomcat 5.0/webapps/ROOT"
ServerName www.zz.com, www.yy.com
ErrorLog logs/zzyy.com-error_log
CustomLog logs/zzyy.com-access_log common
ProxyPass / http://127.0.0.1:82/
ProxyPassReverse / http://127.0.0.1:82/
</VirtualHost>
本文介绍了如何使用Apache配置基于主机名的虚拟主机,通过一个IP地址实现多个网站的托管,并展示了如何设置域名访问和URL重写以指向不同的Tomcat应用服务器。此外,还提供了另一种配置思路:通过负载均衡实现单个IP地址上多个虚拟机的部署。
3433

被折叠的 条评论
为什么被折叠?



