nginx|nginx tomcat负载均衡

准备工作:
3台 centos虚拟机
A机器 192.168.0.116:80
B机器 192.168.0.117:8080
【nginx|nginx tomcat负载均衡】C机器 192.168.0.113:8080
在A机器安装nginx,需安装依赖包,具体如下:
yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yum install -y openssl openssl-devel

下载nginx安装包,解压后运行
./configure
make
make install
利用whereis nginx查找安装目录 /usr/local/nginx
cd sbin
开启关闭nginx
./nginx开启
./nginx -s stop 关闭


修改配置nginx配置文件
/usr/local/nginx/conf/nginx.conf
upstream mysite {
server 192.168.0.117:8080;
server 192.168.0.113:8080;
ip_hash;



server {
listen80;
server_namelocalhost;


#charset koi8-r;


#access_loglogs/host.access.logmain;


location / {
roothtml;
indexindex.html index.htm;
proxy_pass http://mysite;
}



访问http://localhost或者http://192.168.0.116查看效果




    推荐阅读