随笔分类 - Nginx&Openresty&Lua
摘要:这里对负载均衡概念和nginx负载均衡实现方式做一个总结: 先说一下负载均衡的概念: Load Balance负载均衡是用于解决一台机器(一个进程)无法解决所有请求而产生的一种算法。 我们知道单台服务器的性能是有上限的,当流量很大时,就需要使用多台服务器来共同提供服务,这就是所谓的集群。 负载均衡服
阅读全文
摘要:Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in a request exceeds the
阅读全文
摘要:1 Background http://nginx.org/en/docs/http/ngx_http_stub_status_module.html ngx_http_stub_status_module 是一个 Nginx 的内置 HTTP 模块,该模块可以提供 Nginx 的状态信息。默认情况
阅读全文
摘要:在本小节我们介绍一个用于Nginx对后端UpStream集群节点健康状态检查的第三方模块:nginx_upstream_check_module(https://github.com/yaoweibin/nginx_upstream_check_module)。这个模块有资料介绍是TaoBao团队开
阅读全文
摘要:1、概述(可以直接跳过看第2部分) Nginx方便地帮助我们实现了平滑升级。其原理简单概括,就是: (1)在不停掉老进程的情况下,启动新进程。 (2)老进程负责处理仍然没有处理完的请求,但不再接受处理请求。 (3)新进程接受新请求。 (4)老进程处理完所有请求,关闭所有连接后,停止。 这样就很方便地
阅读全文
摘要:进一步分析报错原因,具体步骤如下: l 查看这两台系统最大的允许文件打开数 [root@nginx01 logs]# cat /proc/sys/fs/file-max 343927 l 通过ulimit -n命令可以查看目前该linux系统里打开文件描述符的最大值 [root@nginx01 lo
阅读全文
摘要:Web服务器在用着nginx,在日志中偶尔会看到有499这个错误。 rfc2616中,400~500间的错误码仅定义到了417,所以499应该是nginx自己定义的。后来想到读读nginx代码,疑问立解。 查看nginx源代码的方法: 1.解压nginx-1.4.7.tar.gz tar zxf n
阅读全文
摘要:command = /usr/local/bin/nginx 这个命令默认是后台启动,但是supervisor不能监控后台程序,所以supervisor就一直执行这个命令。 加上-g 'daemon off;'这个参数可解决这问题,这个参数的意思是在前台运行。 command = /usr/local/bin/nginx -g 'daemon off;'
阅读全文
摘要:vim nginx.conf 修改user nginx为当前系统用户,如:user root
阅读全文
摘要:使用nginx时, 有可能遇到connect() failed (111: Connection refused) while connecting to upstream的问题。 如果upstream是fastcgi://127.0.0.1:9000,造成这个问题的原因大致有三个 1.php-fp
阅读全文
摘要:下载php源码包 http://www.php.net/downloads.php 安装php 可能出现的错误 出现错误: congigure error: xml2-config not found 解决办法: 1.执行命令: 2.查看是否成功: 出现错误: congigure error: Ca
阅读全文
摘要:nginx自己不会对日志文件进行切割,可以通过两种不同的方式进行,分别是:通过logrotate和通过shell脚本。 如果是yum方式安装的nginx,系统默认会自动通过logrotate这个日志管理软件,按天进行分割(配置如下,具体含义可看下文)。 下面分别对这两种方法进行介绍下: 一、使用lo
阅读全文
摘要:Nginx 的 access log 默认是以空格分隔的字符串形式记录的,格式如下 官方支持json格式 Specifies the log format, for example: The escape parameter (1.11.8) allows setting json or defau
阅读全文
摘要:关于 http://openresty.org/cn/about.html 这个开源 Web 平台主要由章亦春(agentzh)维护。在 2011 年之前曾由淘宝网赞助,在后来的 2012 ~ 2016 年间主要由美国的 CloudFlare 公司 提供支持。目前,OpenResty® 主要由 Op
阅读全文
摘要:lua-nginx-module模块地址 https://github.com/openresty/lua-nginx-module It is highly recommended to use OpenResty releases which integrate Nginx, ngx_lua,
阅读全文
摘要:问题分析 Nginx没有添加modules/ngx_http_stub_status_module.o模块。 问题解决 没有安装的话,可以在tar包安装编译的时候添加如下参数: # ./configure --prefix=/usr/local/nginx --with-http_stub_stat
阅读全文
摘要:lua.c:80:31: fatal error: readline/readline.h: No such file or directory#include <readline/readline.h>^compilation terminated.make[2]: *** [lua.o] Err
阅读全文
摘要:官网http://www.lua.org/download.html Building Lua is implemented in pure ANSI C and compiles unmodified in all platforms that have an ANSI C compiler. L
阅读全文
摘要:nginx自1.9.0开始提供tcp/udp的反向代理功能,直到1.11.4才开始提供session日志功能。 启用stream日志配置文件 主配置文件/etc/nginx/nginx.conf增加内容: stream { log_format proxy 'time_
阅读全文
摘要:In March, 2013 we released the first version of the “nginx web server” plug‑in for New Relic monitoring of the open source NGINX software and NGINX Pl
阅读全文