参考资料
https://github.com/chaoslawful/lua-nginx-module
https://github.com/agentzh/echo-nginx-module
将nginx,lua-nginx-module,echo-nginx-module从git上下载下来。
我的都下载到了
/home/fansxnet/gitproject/目录下了。
cd /home/fansxnet/gitproject/nginx
./configure --user=fansxnet --group=fansxnet --prefix=/home/fansxnet/gitproject/nginx --add-module=/home/fansxnet/gitproject/echo-nginx-module --add-module=/home/fansxnet/gitproject/lua-nginx-module
adding module in /home/fansxnet/gitproject/echo-nginx-module + ngx_http_echo_module was configured adding module in /home/fansxnet/gitproject/lua-nginx-module checking for Lua library ... found checking for export symbols by default ... found + ngx_http_lua_module was configured checking for PCRE library ... found checking for PCRE JIT support ... found checking for system md library ... not found checking for system md5 library ... not found checking for OpenSSL md5 crypto library ... found checking for sha1 in system md library ... not found checking for OpenSSL sha1 crypto library ... found checking for zlib library ... found creating objs/Makefile Configuration summary + using system PCRE library + OpenSSL library is not used + md5: using system crypto library + sha1: using system crypto library + using system zlib library nginx path prefix: "/home/fansxnet/gitproject/nginx" nginx binary file: "/home/fansxnet/gitproject/nginx/sbin/nginx" nginx configuration prefix: "/home/fansxnet/gitproject/nginx/conf" nginx configuration file: "/home/fansxnet/gitproject/nginx/conf/nginx.conf" nginx pid file: "/home/fansxnet/gitproject/nginx/logs/nginx.pid" nginx error log file: "/home/fansxnet/gitproject/nginx/logs/error.log" nginx http access log file: "/home/fansxnet/gitproject/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
编译的时候,提示库没有找到的,可以根据提示的库名,google后,一个个安装
make # 如果没有错误,这一步就编译成功了。 cd objs/ ls addon autoconf.err Makefile nginx nginx.8 ngx_auto_config.h ngx_auto_headers.h ngx_modules.c ngx_modules.o src #看到nginx,编译成功了。
修改配置文件 /home/fansxnet/gitproject/nginx/conf/nginx.conf
# 用户名,组 user fansxnet fansxnet; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } 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; server { listen 80; server_name localhost; #access_log logs/host.access.log main; #设置虚拟目录 root /home/fansxnet/gitproject/nginx/html/; location / { root html; index index.html index.htm; } #测试用的地址,多个文件合并成一个返回给浏览器 #http://127.0.0.1/merge?/js/jquery-1.2.6.min.js&/js/index.js location /merge { default_type 'text/javascript'; echo_foreach_split '&' $query_string; echo "/* JS File $echo_it */"; echo_location_async $echo_it; echo; echo_end; } #测试用的地址,测试lua脚本执行 http://127.0.0.1/recur?num=5 location /recur { # MIME type determined by default_type: default_type 'text/plain'; content_by_lua ' local num = tonumber(ngx.var.arg_num) or 0 if num > 50 then ngx.say("num too big") return end ngx.say("num is: ", num) if num > 0 then res = ngx.location.capture("/recur?num=" .. tostring(num - 1)) ngx.print("status=", res.status, " ") ngx.print("body=", res.body) else ngx.say("end") end '; } # 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://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; # } #} }
切换到root下。
注意我的当前路径是能够nginx源码目录 /home/fansxnet/gitproject/nginx/objs
./nginx #启动后可以测试了 ./nginx -s stop # 停止了
相关推荐
lua-nginx-module-0.10.13
nginx集成lua脚本模块,配合nginx和ngx_devel_kit一起使用,注意lua_nginx_module的版本号,否则会出现时间类型不兼容
lua-nginx-module-master,nginx编译lua模块必需文件lua-nginx-module
lua-nginx-module (ngx_lua) 可在 Nginx 中嵌入 Lua 语言。让 Nginx 可以支持 Lua 强大的语法。
lua-upstream-nginx-module, Nginx C 模块将Lua向ngx_lua公开,用于 Nginx upstreams 电子邮件名称ngx_http_lua_upstream - Nginx MODULE,用于向 Nginx upstreams公开Lua到 ngx_lua目录NAME状态概要说明函数get_...
通过概要,指令,api接口三方面阐述lua-nginx模块的使用。 使用Lua编写Nginx脚本的基本构建块是指令。指令用于指定何时运行用户Lua代码以及如何使用结果。 在nginx.conf文件中各种*_by_lua,*_by_lua_block和*_by_...
lua-nginx-module-0.10.20.tar.gz
ngx-lua-module ngx_lua_upstream headers-more-nginx-module rds-json-nginx-module nginx-http-concat-module redis2-nginx-module and these C module for Lua: 以及这些用于 Lua 的 C 模块: lua-cjson lua-...
headers-more-nginx-module-0.34
OpenResty 是一个强大的 Web 应用服务器,Web 开发人员可以使用 Lua 脚本语言调动 Nginx 支持的各种 C 以及 Lua 模块,更主要的是在性能方面,OpenResty可以 快速构造出足以胜任 10K 以上并发连接响应的超高性能 Web ...
配合Ngixn调试一些参入,如GeoIP,Lua等,打印一些变量 echo-nginx-module-0.58.tar.gz
ngx_stream_lua_module-将Lua的功能嵌入到Nginx流/ TCP服务器中。 该模块是OpenResty的核心组件。 如果您使用的是此模块,则实际上是在使用OpenResty。 该模块不随Nginx源一起分发。 请参阅。 目录 代码库 错误和...
lua-nginx-module-0.10.22.tar.gz # 0.10.16 以后都需要 lua-resty-core和lua-resty-lrucache lua-resty-core-0.1.24.tar.gz [lua-nginx-module依赖] lua-resty-lrucache-0.12.tar ngx_devel_kit-0.3.2.tar.gz nginx...
特性很牛叉,可自行百度查看,这里主要是示范一下,如何在Nginx下安装lua-nginx-module模块 当然,如果你之前没有安装过Nginx,而且嫌安装麻烦,可直接下载openresty安装简单快捷,...
使用lua-nginx-module和lua-upstream-module以及ngx_devel_kit安装nginx ./configure --with-ld-opt=-Wl,-rpath,/usr/local/lib --add-module=lua-nginx-module --add-module=lua-upstream-nginx-module --add-...
lua支持nginx的插件。版本是16的源码包。支持缩略图支持
nginx-echo-lua-module模块安装以及实验nginx-echo-lua-module模块安装以及实验
# yum -y install -y pcre* openssl* # for pcre, such as ngx.gmatch etc, --with-pcre=PATH/pcre-8.36 --with-pcre-jit # if use openssl, then need --with-... --add-module=src/tcp/ngx_tcp_lua_module