mac下nginx + tomcat7负载均衡
去tomcat官网:http://tomcat.apache.org/download-70.cgi 下载你的版本
解压到指定目录:
localhost:tomcat rolin$ pwd
/Users/rolin/soft/tomcat #我的目录
复制一份:
localhost:tomcat rolin$ ll
total 0
drwxr-xr-x 13 rolin staff 442 5 15 23:43 apache-tomcat-7.0.62-1
drwxr-xr-x 13 rolin staff 442 5 15 23:44 apache-tomcat-7.0.62-2
配置文件内容:
在conf/server.xml
localhost:tomcat rolin$ cat apache-tomcat-7.0.62-1/conf/server.xml
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
connectionTimeout="20000"
redirectPort="8444" />
resourceName="UserDatabase"/>
unpackWARs="true" autoDeploy="true">
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
localhost:tomcat rolin$ cat apache-tomcat-7.0.62-2/conf/server.xml
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
connectionTimeout="20000"
redirectPort="8443" />
resourceName="UserDatabase"/>
unpackWARs="true" autoDeploy="true">
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
启动:
./apache-tomcat-7.0.62-1/bin/startup.sh
./apache-tomcat-7.0.62-2/bin/startup.sh
地址:
http://localhost:8081/
出现猫就是正确.
2.nginx安装:
Mac上是利用brew安装的
brew:安装,需要sudo权限
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
nginx安装命令:
上一篇: jQuery实现左右轮播图效果的分享