参考文章 http://www.ttlsa.com/tomcat/config-multi-tomcat-instance/
修改conf/server.xml
<Server port="8001" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
有几个就修改几个server.xml 红色部分数值依次增加
启动文件tomcat.sh
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
#
AuthName:凉白开
#
Website:http://www.ttlsa.com
#
DateTime:2014-05-04
#
description: 启动tomcat多实例.
./etc/init.d/functions
RETVAL=$?
#
tomcat实例目录
exportCATALINA_BASE="$PWD"
#
tomcat安装目录
exportCATALINA_HOME="/usr/local/tomcat-7.0.50"
#
可选
exportJVM_OPTIONS="-Xms128m
-Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m"
case"$1"in
start)
if[-f$CATALINA_HOME/bin/startup.sh];then
echo$"Start
Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if[-f$CATALINA_HOME/bin/shutdown.sh];then
echo$"Stop
Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo$"Usage:
$0 {start|stop}"
exit1
;;
esac
exit$RETVAL
|
启动和关闭代码分别是 ./tomcat.sh start ./tomcat.sh stop
所有网站项目都这么配置
转到Nginx
在 Nginx/conf/nginx.conf文件中,将 server{}删除,取代之
include /usr/lcoal/nginx/conf/vhosts/*;
然后建立并在 vhosts 文件夹里写各个网站的访问规则。例如
// 注意端口号一定要与上面改动的一致
server {
listen 80;
server_name biusxxp.com www.biusxxp.com;
location / {
index index.html index.htm index.jsp;
proxy_pass http://127.0.0.1:8081;
}
}