apache虚拟主机配置实例教程

发布时间:2020-07-21编辑:脚本学堂
本文介绍了apache中配置虚拟主机的方法,有关apache虚拟主机配置的实例教程,感兴趣的朋友参考下。

相关信息:
JkWorkersFile "conf/workers.properties"
JkLogFile "logs/mod_jk2.log"
JkLogLevel info
NameVirtualHost 202.102.53.111

例子,设置虚拟主机www.jb200.com
 

复制代码 代码示例:
<VirtualHost 202.102.53.111>
   ServerAdmin jbxue#jb200.com
   DocumentRoot D:/tomcat504B2C/webapps/Root/
   DirectoryIndex index.html index.htm index.jsp
   ServerName www.jb200.com
   ErrorLog logs/shsc-error_log.txt
   CustomLog logs/shsc-access_log.txt common
   Jklinuxjishu/9952.html target=_blank class=infotextkey>mount / worker1 
   #JkMount /examples/servlet/* ajp13
   #让apache支持对servlet传送,用以Tomcat解析
   JkMount /*.jsp worker1
   #让Apache支持对jsp传送,用以Tomcat解析
   JkMount /*.do worker1
   #让Apache支持对cots的do命令传送,用以Tomcat解析     
</VirtualHost>

例2,设置虚拟主机esales.jb200.com
 

复制代码 代码示例:
<VirtualHost 202.102.53.111>
   ServerAdmin jbxue#jb200.com
   DocumentRoot D:/Tomcat504SALE/webapps/Root/
   DirectoryIndex index.html index.htm index.jsp
   ServerName esales.jb200.com
   ErrorLog logs/shsc-error_log.txt
   CustomLog logs/shsc-access_log.txt common
   JkMount / worker2
   #JkMount /examples/servlet/* ajp13
   #让Apache支持对servlet传送,用以Tomcat解析
   JkMount /*.jsp worker2
   #让Apache支持对jsp传送,用以Tomcat解析
   JkMount /*.do worker2
   #让Apache支持对cots的do命令传送,用以Tomcat解析
</VirtualHost>

例3,配置两个tomcat与apache整合(相关阅读:apache与tomcat配置教程) 。
 

复制代码 代码示例:

workers.properties
worker.list=worker1,worker2
worker.worker1.port=8007
worker.worker1.host=www.jb200.com
worker.worker1.type=ajp13
worker.worker1.lbfactor=50
worker.worker1.tomcat_home=D:/Tomcat504B2C
worker.worker1.java_home=C:/j2sdk1.4.2_07

worker.worker2.port=8008
worker.worker2.host=esales.jb200.com
worker.worker2.type=ajp13
worker.worker2.lbfactor=50
worker.worker2.tomcat_home=D:/Tomcat504SALE
worker.worker2.java_home=C:/j2sdk1.4.2_07