Nginx
kanguolaikanguolaik
2013.08.07 今天是个好日子
展开
-
Nginx编译:Linux
Linux下一、下载安装包 文件名:nginx-1.5.4.tar.gz 下载地址:http://nginx.org/en/download.html 点击“nginx-1.5.4”下载二、解压缩 tar zxvf nginx-1.5.4.tar.gz 三、编译前准备3.1 模块依赖 gcc、autoconf、autom原创 2013-09-04 15:16:52 · 1509 阅读 · 0 评论 -
Nginx:Purge,ngx_cache_purge模块
一、介绍 ngx_cache_purge是由labs.frickle.com开发的一个Nginx第三方模块。 通过该模块使得Nginx可以使用PURGE指令手动清除指定URL的缓存页面。二、下载、编译到Nginx2.1 下载ngx_cache_purge 官网:http://labs.frickle.com/nginx_ngx_ca原创 2016-03-10 18:22:36 · 2274 阅读 · 0 评论 -
Nginx:作为缓存,支持Range回源
一、Range回源1.1 Nginx的Range回源、ngx_http_slice_module模块、--with-http_slice_module参数 Nginx的ngx_http_slice_module模块是用来支持Range回源的。 ngx_http_slice_module从Nginx的1.9.8版本开始有的。 启用ngx_ht原创 2016-03-09 16:40:28 · 15681 阅读 · 0 评论 -
Lua:下载安装lua-cjson,lua操作json代码,指定require搜索路径
一、下载安装1.1 lua-cjson官网 官网:http://www.kyne.com.au/~mark/software/lua-cjson-manual.html1.2 下载安装 wget http://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.tar.gz t原创 2016-03-10 17:05:28 · 10925 阅读 · 0 评论 -
Nginx:作为cdn缓存时,follow 302
一、应用环境1.1 rewrite www.guowenyan.cn/test.html(任意url) rewrite www.guowenyan.cn/test01.html1.2 302 www.guowenyan.cn/test01.html 302 www.guowe原创 2016-03-08 18:54:36 · 4074 阅读 · 0 评论 -
Nginx:设置Nginx作为缓存
一、设置Nginx作为缓存1.1 完整的配置文件nginx.conf#user nobody;worker_processes 1;events { worker_connections 1024;}http { log_format main '$remote_addr - $remote_user [$time_local] "$request"原创 2016-03-07 18:46:52 · 2346 阅读 · 0 评论 -
Nginx编写HTTP模块:“Hello World”的第二种写法(HTTP模块介入阶段的2种方法)
二、“Hello World”两种写法的不同1.1 第1种写法 1. 通过设置ngx_http_core_loc_conf_t结构体的handler指针来实现。 2. 仅仅用于URL匹配了location的用户请求 。 参照:Nginx编写HTTP模块:第一个Nginx HTTP模块 “Hello World”:http://b原创 2015-12-09 11:42:52 · 1069 阅读 · 0 评论 -
Nginx:设置为HTTP代理服务器上网,使用upstream
一、配置文件Nginx作为代理,将请求交给Cache处理,如果Cache没有缓存,就回源。通过upstream,可以实现多个Cache缓存之间的负载均衡。worker_processes 1;events { worker_connections 1024;}http { log_format main '$remote_addr - $remote_原创 2015-12-15 15:36:39 · 2939 阅读 · 0 评论 -
Nginx+Lua访问Redis
一、代码1.1 准备1. 启动redis src/redis-server2. 启动redis客户端,设置domain src/redis-cli set domain *.baidu.com1.2 代码local redis = require "resty.redis"local cache = redis.原创 2015-11-19 16:24:52 · 2895 阅读 · 0 评论 -
Lua:Nginx Lua环境配置,第一个Nginx Lua代码
一、编译安装LuaJIT Lua:编译安装LuaJIT,第一个Lua程序,http://blog.csdn.net/guowenyan001/article/details/48250427二、下载NDK与Lua_module2.1 下载NDK,解压缩 wget -c https://github.com/simpl/ngx_devel_kit/arch原创 2015-09-06 20:54:47 · 5196 阅读 · 0 评论 -
Nginx编写HTTP模块:第一个Nginx HTTP模块 “Hello World!”
写一个Nginx的http模块,当向Nginx发送请求时,Nginx返回“Hello World!”一、代码 文件名:ngx_http_mytest_module.c#include #include #include #include static ngx_int_t ngx_http_mytest_handler(ngx_http_request_t *原创 2015-05-01 21:49:31 · 2467 阅读 · 0 评论 -
Nginx:设置为HTTP代理服务器上网
一、设置NGINX为HTTP代理服务器1.1 设置Nginx为HTTP代理服务器上网,只需要3步(vim /usr/local/nginx/conf/nginx.conf): 1. 增加dns解析resolver。 可以查看/etc/resolv.conf中的配置。 2. 增加server。 server_name可以有也可以没有,如果没有则指直接使用IP,如果原创 2014-04-01 10:29:19 · 12433 阅读 · 2 评论 -
Nginx下载、编译、启动/停止/平滑重启、文档
一、Nginx下载 官网下载地址:http://nginx.org/en/download.html二、Nginx编译 CSDN上博客的编译:http://blog.csdn.net/guowenyan001/article/details/11060735三、Nginx启动/停止3.1 Nginx启动3.2 Nginx停止原创 2013-09-04 15:23:35 · 1592 阅读 · 0 评论 -
Nginx:一致性哈希(第三方模块ngx_http_consistent_hash)
一、介绍 Nginx upstream可以实现负载均衡。 第三方模块ngx_http_consistent_hash通过一致性哈希算法来选择合适的后端节点。二、下载、编译到Nginx2.1 下载 文件名:ngx_http_consistent_hash-master.zip github下载:https://githu原创 2016-05-03 16:58:37 · 9508 阅读 · 0 评论