欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

mac下nginx + tomcat7负载均衡

程序员文章站 2022-04-20 14:16:52
...
1.tomcat安装:

去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安装命令:

brew install nginx