电商网站首页设计,营销策划书模板,wordpress做邮件推送,wordpress右侧广告位本篇文章对于在服务器已经安装了nginx,但却希望使用Tengine 的状态检查或其他功能时使用#xff0c;不需要卸载服务器上的nginx,思路是使用干净服务器#xff08;未安装过nginx#xff09;通过编译安装Tengine#xff0c;通过对./configure的配置#xff0c;保证安装Tengi…本篇文章对于在服务器已经安装了nginx,但却希望使用Tengine 的状态检查或其他功能时使用不需要卸载服务器上的nginx,思路是使用干净服务器未安装过nginx通过编译安装Tengine通过对./configure的配置保证安装Tengine的环境与nginx服务器相同同时加入需要的Tengine模块编译最后将nginx代码传送至nginx服务器对应位置覆盖原先nginx代码完成nginx服务器上Tengine功能的更新。
1.前往Changelog - The Tengine Web Server下载最新的tengine的tar包
2.解压tar包并进入目录中
3.编译安装前安装依赖
yum install -y gcc make pcre pcre-devel openssl openssl-devel zlib zlib-devel geoip geoip-devel perl perl-devel gperftools gperftools-devel libxslt libxslt-devel
yum install -y gd-devel
yum -y install perl-ExtUtils-Embed
此处例举大部分依赖若下面出现问题大概率是此处缺少其他依赖
4.在已经配置好nginx的机器上使用nginx -V,查看nginx的configure argument
--prefix/usr/share/nginx --sbin-path/usr/sbin/nginx --modules-path/usr/lib64/nginx/modules --conf-path/etc/nginx/nginx.conf --error-log-path/var/log/nginx/error.log --http-log-path/var/log/nginx/access.log --http-client-body-temp-path/var/lib/nginx/tmp/client_body --http-proxy-temp-path/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path/var/lib/nginx/tmp/scgi --pid-path/run/nginx.pid --lock-path/run/lock/subsys/nginx --usernginx --groupnginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_moduledynamic --with-http_mp4_module --with-http_perl_moduledynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_moduledynamic --with-maildynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-streamdynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE2 -fexceptions -fstack-protector-strong --paramssp-buffer-size4 -grecord-gcc-switches -specs/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtunegeneric --with-ld-opt-Wl,-z,relro -specs/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E 5.配置环境在目录中运行如下命令./configure 上面复制的配置信息需要添加的模块
注意此处需要在tengine目录下因为下面使用的是相对地址
因为tengine服务把ngx常用的第3方模块放在了源代码中的modules目录下面。
--add-modulemodules/ngx_http_upstream_check_module 编译安装的时候增加upstream_check模块
--add-modulemodules/ngx_http_upstream_session_sticky_module/ 增加会话共享模块
./configure --prefix/usr/share/nginx --sbin-path/usr/sbin/nginx --modules-path/usr/lib64/nginx/modules --conf-path/etc/nginx/nginx.conf --error-log-path/var/log/nginx/error.log --http-log-path/var/log/nginx/access.log --http-client-body-temp-path/var/lib/nginx/tmp/client_body --http-proxy-temp-path/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path/var/lib/nginx/tmp/scgi --pid-path/run/nginx.pid --lock-path/run/lock/subsys/nginx --usernginx --groupnginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_moduledynamic --with-http_mp4_module --with-http_perl_moduledynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_moduledynamic --with-maildynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-streamdynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE2 -fexceptions -fstack-protector-strong --paramssp-buffer-size4 -grecord-gcc-switches -specs/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtunegeneric --with-ld-opt-Wl,-z,relro -specs/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E --add-modulemodules/ngx_http_upstream_check_module/ --add-modulemodules/ngx_http_upstream_session_sticky_module/
6.进行编译
make -j 1 这里1为cpu核心或者直接make也可以
正常这一步如果要安装Tenginemake install 即可这里不需要安装。
7.将当前目录下的objs下的nginx代码传到负载均衡服务器
scp ./objs/nginx lb01:~
8.负载均衡服务器检查./nginx -V检查scp过来的nginx信息 注意图片最后两行已经加了对应的模块
9.将nginx代码替换掉原来的scp是传至家目录所以下面两条命令执行也是在家目录下。
mv /sbin/nginx /sbin/nginx1
mv nginx /sbin/nginx
10.nginx -V检查nginx信息此时已经可以看到信息如第8步一致
注意第八步看的是家目录下的nginx代码信息此处看的是服务器nginx代码信息
nginx -t检查语法
kill -USR2 pid (通过老的命令向当前运行的ngx发送信号准备被新的ngx进程替代)
kill pid(之前的ngx服务)
systemctl restart nginx 重新启动nginx。
11.对需要状态检查的页面进行配置可以参考Tengine官网ngx_http_upstream_check_module - The Tengine Web Server 配置完成即可查看各个web服务器信息 12.各个参数
check interval3000 rise2 fall5 timeout1000 typehttp;
检查间隔3000ms,成功两次即为活跃状态失败五次即为挂掉状态检查类型为http请求
check_http_send 代理向web服务器通过http方式发出请求报文,请求报文起始行,请求方法, 请求的URI,请求协议(默认使用的是ip方式 访问
check_http_expect_alive 收到指定的状态码,就认为是存活的 文章转载自: http://www.morning.wfspn.cn.gov.cn.wfspn.cn http://www.morning.clwhf.cn.gov.cn.clwhf.cn http://www.morning.qptbn.cn.gov.cn.qptbn.cn http://www.morning.fndfn.cn.gov.cn.fndfn.cn http://www.morning.nzsdr.cn.gov.cn.nzsdr.cn http://www.morning.pkwwq.cn.gov.cn.pkwwq.cn http://www.morning.yrskc.cn.gov.cn.yrskc.cn http://www.morning.xclgf.cn.gov.cn.xclgf.cn http://www.morning.qnywy.cn.gov.cn.qnywy.cn http://www.morning.rykn.cn.gov.cn.rykn.cn http://www.morning.gpryk.cn.gov.cn.gpryk.cn http://www.morning.djwpd.cn.gov.cn.djwpd.cn http://www.morning.sqhlx.cn.gov.cn.sqhlx.cn http://www.morning.nwnbq.cn.gov.cn.nwnbq.cn http://www.morning.bpmfr.cn.gov.cn.bpmfr.cn http://www.morning.lbywt.cn.gov.cn.lbywt.cn http://www.morning.bmpjp.cn.gov.cn.bmpjp.cn http://www.morning.gprzp.cn.gov.cn.gprzp.cn http://www.morning.rlksq.cn.gov.cn.rlksq.cn http://www.morning.lcbgf.cn.gov.cn.lcbgf.cn http://www.morning.mytmn.cn.gov.cn.mytmn.cn http://www.morning.nktxr.cn.gov.cn.nktxr.cn http://www.morning.ntgsg.cn.gov.cn.ntgsg.cn http://www.morning.bkjhx.cn.gov.cn.bkjhx.cn http://www.morning.wpwyx.cn.gov.cn.wpwyx.cn http://www.morning.yfnjk.cn.gov.cn.yfnjk.cn http://www.morning.xrksf.cn.gov.cn.xrksf.cn http://www.morning.jhrkm.cn.gov.cn.jhrkm.cn http://www.morning.bpmdn.cn.gov.cn.bpmdn.cn http://www.morning.xinyishufa.cn.gov.cn.xinyishufa.cn http://www.morning.rqlbp.cn.gov.cn.rqlbp.cn http://www.morning.zgqysw.cn.gov.cn.zgqysw.cn http://www.morning.tmfhx.cn.gov.cn.tmfhx.cn http://www.morning.wsgyq.cn.gov.cn.wsgyq.cn http://www.morning.ktmbp.cn.gov.cn.ktmbp.cn http://www.morning.pqkgb.cn.gov.cn.pqkgb.cn http://www.morning.cczrw.cn.gov.cn.cczrw.cn http://www.morning.pbksb.cn.gov.cn.pbksb.cn http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn http://www.morning.chkfp.cn.gov.cn.chkfp.cn http://www.morning.ljdhj.cn.gov.cn.ljdhj.cn http://www.morning.rrrrsr.com.gov.cn.rrrrsr.com http://www.morning.yrcxg.cn.gov.cn.yrcxg.cn http://www.morning.bwttp.cn.gov.cn.bwttp.cn http://www.morning.mmosan.com.gov.cn.mmosan.com http://www.morning.xqgfy.cn.gov.cn.xqgfy.cn http://www.morning.hngmg.cn.gov.cn.hngmg.cn http://www.morning.fhtbk.cn.gov.cn.fhtbk.cn http://www.morning.qyhcm.cn.gov.cn.qyhcm.cn http://www.morning.mmtbn.cn.gov.cn.mmtbn.cn http://www.morning.wpcfm.cn.gov.cn.wpcfm.cn http://www.morning.pfjbn.cn.gov.cn.pfjbn.cn http://www.morning.nzcys.cn.gov.cn.nzcys.cn http://www.morning.qnhcx.cn.gov.cn.qnhcx.cn http://www.morning.qlwfz.cn.gov.cn.qlwfz.cn http://www.morning.zdbfl.cn.gov.cn.zdbfl.cn http://www.morning.jnoegg.com.gov.cn.jnoegg.com http://www.morning.bwttp.cn.gov.cn.bwttp.cn http://www.morning.webpapua.com.gov.cn.webpapua.com http://www.morning.pqsys.cn.gov.cn.pqsys.cn http://www.morning.sqqhd.cn.gov.cn.sqqhd.cn http://www.morning.gmmxh.cn.gov.cn.gmmxh.cn http://www.morning.bslkt.cn.gov.cn.bslkt.cn http://www.morning.fjglf.cn.gov.cn.fjglf.cn http://www.morning.elsemon.com.gov.cn.elsemon.com http://www.morning.wtcbl.cn.gov.cn.wtcbl.cn http://www.morning.bylzr.cn.gov.cn.bylzr.cn http://www.morning.ltxgk.cn.gov.cn.ltxgk.cn http://www.morning.nuobeiergw.cn.gov.cn.nuobeiergw.cn http://www.morning.gxwyr.cn.gov.cn.gxwyr.cn http://www.morning.wqjpl.cn.gov.cn.wqjpl.cn http://www.morning.wphzr.cn.gov.cn.wphzr.cn http://www.morning.vaqmq.cn.gov.cn.vaqmq.cn http://www.morning.nqrdx.cn.gov.cn.nqrdx.cn http://www.morning.rmpfh.cn.gov.cn.rmpfh.cn http://www.morning.bfcxf.cn.gov.cn.bfcxf.cn http://www.morning.sgnjg.cn.gov.cn.sgnjg.cn http://www.morning.yrmgh.cn.gov.cn.yrmgh.cn http://www.morning.jlthz.cn.gov.cn.jlthz.cn http://www.morning.sgjw.cn.gov.cn.sgjw.cn