nginx 实现openfire负载

来源:互联网 发布:淘宝店铺的名字 编辑:程序博客网 时间:2024/05/21 12:39

首先假定你已安装好Nginx,并切换到Nginx的安装目录,执行补丁操作,并进行安装:


1. 要实现openfire负载,需要添加nginx nginx_tcp_proxy_module模块

 编译nginx_tcp_proxy_module:

下载: 我将下载文件存放在  /usr/local/src/ 下

wget https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip

2.编译添加的 nginx_tcp_proxy_module模块

 patch -p1 < /usr/local/src/nginx_tcp_proxy_module/tcp.patch  ./configure --add-module=/usr/local/src/nginx_tcp_proxy_module/makemake install 

如果系统没有安装patch,需要安装,如果安装测忽略。

yum install patch 

3. 修改配置文件nginx.conf:

user  root;worker_processes  4;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {    worker_connections  10240;}tcp  {   timeout 1d;   proxy_read_timeout 10d;   proxy_send_timeout 10d;   proxy_connect_timeout 30;   upstream openfire5222{       server 192.168.2.189:5222;       server 192.168.2.188:5222;   }   server{    listen 5222;    proxy_pass openfire5222;        so_keepalive on;        tcp_nodelay on;    }   upstream openfire5223{        server 192.168.2.189:5223;        server 192.168.2.188:5223;    }   server{        listen 5223;        proxy_pass openfire5223;        so_keepalive on;        tcp_nodelay on;   }}http {    include       mime.types;    default_type  application/octet-stream;    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '    #                  '$status $body_bytes_sent "$http_referer" '    #                  '"$http_user_agent" "$http_x_forwarded_for"';    #access_log  logs/access.log  main;    sendfile        on;    #tcp_nopush     on;    #keepalive_timeout  0;    keepalive_timeout  65;    #gzip  on;    upstream openfire7070{        server 192.168.2.189:7070;        server 192.168.2.188:7070;    }    server{        listen 7070;        server_name 192.168.2.191;        location / {          proxy_pass http://openfire7070;        }    }    upstream openfire9090{        server 192.168.2.189:9090;        server 192.168.2.188:9090;        ip_hash;    }    server {        listen 9090;        server_name localhost;        location / {            proxy_pass http://openfire9090;        }    }    server {        listen       8086;        server_name  192.168.2.191;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {            root   html;            index  index.html index.htm;        }    location /status{        tcp_check_status;    }        #error_page  404              /404.html;        # redirect server error pages to the static page /50x.html        #        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }        # proxy the PHP scripts to Apache listening on 127.0.0.1:80        #        #location ~ \.php$ {        #    proxy_pass   http://go.rritw.com/127.0.0.1;        #}        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        #location ~ \.php$ {        #    root           html;        #    fastcgi_pass   127.0.0.1:9000;        #    fastcgi_index  index.php;        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;        #    include        fastcgi_params;        #}        # deny access to .htaccess files, if Apache's document root        # concurs with nginx's one        #        #location ~ /\.ht {        #    deny  all;        #}    }    # another virtual host using mix of IP-, name-, and port-based configuration    #    #server {    #    listen       8000;    #    listen       somename:8080;    #    server_name  somename  alias  another.alias;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}    # HTTPS server    #    #server {    #    listen       443;    #    server_name  localhost;    #    ssl                  on;    #    ssl_certificate      cert.pem;    #    ssl_certificate_key  cert.key;    #    ssl_session_timeout  5m;    #    ssl_protocols  SSLv2 SSLv3 TLSv1;    #    ssl_ciphers  HIGH:!aNULL:!MD5;    #    ssl_prefer_server_ciphers   on;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}}

4: 访问:http://192.168.2.191:9090/login.jsp?url=%2Findex.jsp 进行验证。


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 老板不发工资怎么办 没签合同的 牙套粘在牙齿上的松了怎么办 缝的线长在肉里怎么办 小孩喜欢用舌头顶牙齿缝怎么办 1岁多小宝贝全身长红点怎么办 生完胸好涨但很难把奶吸出来怎么办 怀孕快9个月内裤上有白带怎么办 一早起来发现内裤有白色液体怎么办 阴部骚痒白带多白带多小腹痛怎么办 15岁一周鲁了3次怎么办 月经摊迟三天内裤有白带怎么办 怀孕内裤上有黄黄的分泌物怎么办 老公出轨想离婚但舍不得孩子怎么办 老婆出轨离婚又舍不得家我该怎么办 怀孕一个月刚刚自慰有点流血怎么办 老公出轨还不知道悔改妻子怎么办 离婚了前妻户口还在再婚怎么办 怀孕六个月内裤老是湿有异味怎么办 怀孕五个月内裤总是湿有异味怎么办 耳朵里面有个洞老是流水冒浓怎么办 宝宝拉粑粑有臭酸味怎么回事怎么办 老婆晚上回家内裤是湿的尿味怎么办 怀孕五个月下身痒内裤湿怎么办 哺乳期奶水太多经常弄湿衣服怎么办 麻料裙子一坐下就皱怎么办 不小心把答题卡弄皱了怎么办 嘴巴又干又黏又臭怎么办 不小心把红枣核吞了怎么办 小天才电话手表被偷了怎么办 18k金被火烧黑了怎么办 衣服掉色染到别的衣服上怎么办 夏天太阳太毒刚发芽的花种子怎么办 长斑了怎么办 喝玫瑰花茶能祛斑吗 烧纸火纸迷信纸利润太低怎么办 刚买的绣球花花有点蔫怎么办 ZF葡7正常佩戴动能太满怎么办 怀孕初期老婆婆做的菜不好吃怎么办 调节协议已签字不签收调解书怎么办 给晋中苗圃拉了树苗没拿上钱怎么办 多肉旁边长出好多小株怎么办 烤瓷牙制备时颌关系不够怎么办