nginx+tomcat集群

来源:互联网 发布:第三波软件 编辑:程序博客网 时间:2024/06/02 06:40

1、安装必须的环境支持

命令:yum install gcc pcre pcre-devel zlib zlib-devel opensslopenssl-devel

 

2、查看nginx可以指定的参数

3、编译

命令:./configure --prefix=/home/app/nginx-1.8.

 

    

4、安装

命令:make && make install

  

 

5、启动nginx

命令:sbin/nginx

 

 

6、查看nginx进程

命令:ps –uax | grep nginx

          

7、浏览器打开验证

这里是安装机子的IP地址

8、停用nginx

[root@hadoop10 nginx-1.8.0]# sbin/nginx -sstop

[root@hadoop10 nginx-1.8.0]# ps -ef|grepnginx

root      7411   2031  0 00:23 pts/0    00:00:00 grep --color=auto nginx

 

9、修改配置参数, 集群tomcat

upstream igate {

       server hadoop10:8080 weight=3 max_fails=2 fail_timeout=30s;

       server hadoop11:8080 weight=3 max_fails=2 fail_timeout=30s;

       server hadoop12:8080 weight=4 max_fails=2 fail_timeout=30s;

    }

 

   server {

       listen       80;

       server_name  hadoop12;

 

       #charset koi8-r;

 

       #access_log logs/host.access.log  main;

 

       location / {

           root   html;

           index  index.html index.htm;

           proxy_pass   http://igate;

       }

}

  

10、检查配置是否正确

[root@hadoop10 nginx-1.8.0]# sbin/nginx -t

nginx: the configuration file/home/app/nginx-1.8.0/conf/nginx.conf syntax is ok

nginx: configuration file/home/app/nginx-1.8.0/conf/nginx.conf test is successful

 

11、集群成功,可以停用其中一台看看效果

 

0 0
原创粉丝点击