Apache
1. 修改host
- 127.0 . 0.1 www. 1 .com
- 127.0 . 0.1 www. 2 .com
2. 配置httpd.conf
- NameVirtualHost 127.0.0.1
- < VirtualHost 127.0.0.1 >
- ServerAdmin webmaster@dummy-host.example.com
- DocumentRoot WWW/vir1
- ServerName www.1.com
- ErrorLog logs/dummy-host.example.com-error_log
- CustomLog logs/dummy-host.example.com-access_log common
- < / VirtualHost >
- < VirtualHost 127.0.0.1 >
- ServerAdmin webmaster@dummy-host.example.com
- DocumentRoot WWW/vir2
- ServerName www.2.com
- ErrorLog logs/dummy-host.example.com-error_log
- CustomLog logs/dummy-host.example.com-access_log common
- < / VirtualHost >
Tomcat
1. 修改host
- 127.0 . 0.1 www. 1 .com
- 127.0 . 0.1 www. 2 .com
2. 配置server.xml
- < Host name = "www.1.com" appBase = "webapps" unpackWARs = "true" autoDeploy = "true" xmlValidation = "false" xmlNamespaceAware = "false" >
- < Context path = "" docBase = "vir1" debug = "0" reloadable = "true" />
- < / Host >
- < Host name = "www.2.com" appBase = "webapps" unpackWARs = "true" autoDeploy = "true" xmlValidation = "false" xmlNamespaceAware = "false" >
- < Context path = "" docBase = "vir2" debug = "0" reloadable = "true" />
- < / Host >
continue……