博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx fastcgi负载均衡
阅读量:6072 次
发布时间:2019-06-20

本文共 5081 字,大约阅读时间需要 16 分钟。

 

当后端某机器无法连接,或者处理fastcgi请求时异常退出,nginx会将fastcgi请求发送到另外一台机器。

 

配置文件

 

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 backend {  //配置后端机器                server 192.168.22.103:9000;                server 172.28.250.130:9901;        }    server {        listen       8099;            upstream backend {                server 192.168.22.103:9000;                server 172.28.250.130:9901;                }        .......        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        location ~ \.php$ {            root           html;            fastcgi_pass   backend; //指定到后端机器            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;            include        fastcgi_params;        }                ...............

 

2017/10/11 11:12:21 [debug] 24481#0: *66 http upstream request: "/aa.php?"

2017/10/11 11:12:21 [debug] 24481#0: *66 http upstream process header
2017/10/11 11:12:21 [debug] 24481#0: *66 malloc: 0000000006717E30:4096
2017/10/11 11:12:21 [debug] 24481#0: *66 recv: fd:4 0 of 4096
2017/10/11 11:12:21 [error] 24481#0: *66 upstream prematurely closed connection while reading response header from upstream, client: 192.168.22.103, server: localhost, request: "GET /aa.php HTTP/1.1", upstream: "fastcgi://192.168.22.103:9000", host: "172.28.250.184:8099"
2017/10/11 11:12:21 [debug] 24481#0: *66 http next upstream, 2
2017/10/11 11:12:21 [debug] 24481#0: *66 free rr peer 2 4
2017/10/11 11:12:21 [warn] 24481#0: *66 upstream server temporarily disabled while reading response header from upstream, client: 192.168.22.103, server: localhost, request: "GET /aa.php HTTP/1.1", upstream: "fastcgi://192.168.22.103:9000", host: "172.28.250.184:8099"
2017/10/11 11:12:21 [debug] 24481#0: *66 free rr peer failed: 0000000006738850 0
2017/10/11 11:12:21 [debug] 24481#0: *66 close http upstream connection: 4
2017/10/11 11:12:21 [debug] 24481#0: *66 free: 00000000066F71D0, unused: 48
2017/10/11 11:12:21 [debug] 24481#0: *66 event timer del: 4: 1507691601518
2017/10/11 11:12:21 [debug] 24481#0: *66 reusable connection: 0
2017/10/11 11:12:21 [debug] 24481#0: *66 get rr peer, try: 1
2017/10/11 11:12:21 [debug] 24481#0: *66 get rr peer, current: 00000000067388F8 0
2017/10/11 11:12:21 [debug] 24481#0: *66 stream socket 4
2017/10/11 11:12:21 [debug] 24481#0: *66 epoll add connection: fd:4 ev:80000005
2017/10/11 11:12:21 [debug] 24481#0: *66 connect to 172.28.250.130:9901, fd:4 #68
2017/10/11 11:12:21 [debug] 24481#0: *66 http upstream connect: -2
2017/10/11 11:12:21 [debug] 24481#0: *66 posix_memalign: 00000000066F71D0:128 @16
2017/10/11 11:12:21 [debug] 24481#0: *66 event timer add: 4: 60000:1507691601519
2017/10/11 11:12:21 [debug] 24481#0: epoll: stale event 00002AD1E49F92B0
2017/10/11 11:12:21 [debug] 24481#0: timer delta: 1
2017/10/11 11:12:21 [debug] 24481#0: worker cycle
2017/10/11 11:12:21 [debug] 24481#0: epoll timer: 60000
2017/10/11 11:12:21 [debug] 24481#0: epoll: fd:4 ev:0019 d:00002AD1E49F92B1
2017/10/11 11:12:21 [debug] 24481#0: epoll_wait() error on fd:4 ev:0019
2017/10/11 11:12:21 [debug] 24481#0: *66 http upstream request: "/aa.php?"
2017/10/11 11:12:21 [debug] 24481#0: *66 http upstream process header
2017/10/11 11:12:21 [error] 24481#0: *66 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.22.103, server: localhost, request: "GET /aa.php HTTP/1.1", upstream: "fastcgi://172.28.250.130:9901", host: "172.28.250.184:8099"
2017/10/11 11:12:21 [debug] 24481#0: *66 http next upstream, 2
2017/10/11 11:12:21 [debug] 24481#0: *66 free rr peer 1 4
2017/10/11 11:12:21 [warn] 24481#0: *66 upstream server temporarily disabled while connecting to upstream, client: 192.168.22.103, server: localhost, request: "GET /aa.php HTTP/1.1", upstream: "fastcgi://172.28.250.130:9901", host: "172.28.250.184:8099"
2017/10/11 11:12:21 [debug] 24481#0: *66 free rr peer failed: 00000000067388F8 0
2017/10/11 11:12:21 [debug] 24481#0: *66 finalize http upstream request: 502
2017/10/11 11:12:21 [debug] 24481#0: *66 finalize http fastcgi request
2017/10/11 11:12:21 [debug] 24481#0: *66 close http upstream connection: 4
2017/10/11 11:12:21 [debug] 24481#0: *66 free: 00000000066F71D0, unused: 48
2017/10/11 11:12:21 [debug] 24481#0: *66 event timer del: 4: 1507691601519
2017/10/11 11:12:21 [debug] 24481#0: *66 reusable connection: 0
2017/10/11 11:12:21 [debug] 24481#0: *66 http finalize request: 502, "/aa.php?" a:1, c:1
2017/10/11 11:12:21 [debug] 24481#0: *66 http special response: 502, "/aa.php?"
2017/10/11 11:12:21 [debug] 24481#0: *66 internal redirect: "/50x.html?"

 

转载于:https://www.cnblogs.com/ruanjianxian/p/7649660.html

你可能感兴趣的文章
svn客户端常用命令
查看>>
Django学习笔记之——Views
查看>>
win32 下oracle 10.2.0.1.0 致命bug:ORA-27300
查看>>
学习笔记:对下拉菜单的简单封装
查看>>
纯手工打造漂亮的垂直时间轴,使用最简单的HTML+CSS+JQUERY完成100个版本更新记录......
查看>>
css/js在线压缩工具
查看>>
docker
查看>>
使用 Spring 2.5 注释驱动的 IoC 功能
查看>>
2:基本操作:全局显示/操作为漫游/选择/刷新
查看>>
在iOS下使用字体时关于字体名字的问题
查看>>
android获取软件列表
查看>>
原来fastboot boot custom.img可以无需刷机就以启动定制系统(以root)
查看>>
Android 处理调用系统相机生成的被旋转图片
查看>>
修改系统tabbar的高度
查看>>
Git 使用指南
查看>>
背景透明,文字不透明
查看>>
如何删除MYSQL表中的重复数据
查看>>
js中的replace用法
查看>>
Java基础学习总结——Java对象的序列化和反序列化
查看>>
Hadoop集群安装配置教程
查看>>