1. 程式人生 > >nginx新新增lua模組

nginx新新增lua模組

 一 、安裝LuaJit
1.下載LuaJit  http://luajit.org/download.html


[[email protected] src]# wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz




2.安裝
2.1解壓:
[[email protected] src]# tar xzvf LuaJIT-2.0.5.tar.gz
2.2進入解壓目錄
[[email protected] src]# cd LuaJIT-2.0.5
2.3編譯
[[email protected] LuaJIT-2.0.5]# make PREFIX=/usr/local/luajit
2.4完成安裝
[
[email protected]
LuaJIT-2.0.5]# make install PREFIX=/usr/local/luajit


二、下載 ngx_devel_kit (NDK)   https://github.com/simpl/ngx_devel_kit/tags


1.[[email protected] src]# wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz


2. [[email protected] src]# tar xzvf v0.3.0.tar.gz
三、下載 ngx_lua  https://github.com/openresty/lua-nginx-module/tags


1.  [
[email protected]
src]# wget https://github.com/openresty/lua-nginx-module/archive/v0.10.10.tar.gz


2. [[email protected] src]# tar xzvf v0.10.10.tar.gz
四、檢視之前編譯引數


nginx -V
--prefix=/usr/local/nginx --user=www --group=www --with-openssl=/data/soft/openssl-1.0.2l --with-pcre=/data/soft/pcre-8.41 --with-zlib=/data/soft/zlib-1.2.8--with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_gzip_static_module --with-http_flv_module


五、整合


[
[email protected]
luajit]# export LUAJIT_LIB=/usr/local/luajit/lib


[[email protected] luajit]# export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0


./configure --prefix=/usr/local/nginx --user=www --group=www --with-openssl=/data/soft/openssl-1.0.2l --with-pcre=/data/soft/pcre-8.41 --with-zlib=/data/soft/zlib-1.2.8--with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_gzip_static_module --with-http_flv_module--with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/data/soft/ngx_devel_kit-0.3.0/ --add-module=/data/soft/lua-nginx-module-0.10.10/
注意:openssl-1.1.0和lua不相容
make
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak備份以前nginx
service nginx stop
cp objs/nginx /usr/local/nginx/sbin/ y回車
service nginx start
nginx -V 檢查模組是否新增上


六、新增LuaRestyRedisLibrary
git clone https://github.com/openresty/lua-resty-redis.git下載LuaRestyRedisLibrary
vim /usr/local/nginx/conf/nginx.conf
lua_package_path "/usr/local/src/lua-resty-redis/lib/?.lua;;";#在http裡新增

相關推薦

nginx新增lua模組

 一 、安裝LuaJit 1.下載LuaJit  http://luajit.org/download.html [[email protected] src]# wget http://luajit.org/download/LuaJIT-2.0.5.tar.

原始碼安裝nginx並配置Lua模組

今天需要在測試機佈置nginx測試環境,測試機不能聯網。所以只能用scp上傳nginx原始碼安裝。期間遇到不少問題 1.下載nginx原始碼 $wget 'http://sysoev.ru/nginx/nginx-1.2.6.tar.gz' 2.下載lua-nginx-

Ubuntu下編譯安裝nginx新增rtmp模組,推流、拉流播放

mkdir nginx 切換到nginx目錄,下載壓縮包並解壓到當前工作目錄: wget http://nginx.org/download/nginx-1.12.1.tar.gz tar -zxvf nginx-1.12.1.tar.gz 安裝依賴的的庫: sudo ap

nginx入門學習—— 在已安裝好的nginx新增nginx_upstream_check_module模組(三)

nginx模組nginx_upstream_check_module來檢查後端伺服器的健康情況 1.下載nginx_upstream_check_module模組wget https://github.com/yaoweibin/nginx_upstream_check_m

nginx 新增的編譯模組

原已經安裝好的nginx,現在需要新增一個未被編譯安裝的模組 舉例說明:安裝第三方的ngx_cache_purge模組(用於清除指定URL的快取) nginx的模組是需要重新編譯nginx,而不是像a

筆記搬到部落格 - nginx一步步整合lua模組

經過網路搜尋、整理、實踐筆記   前置條件:已安裝nginx   一 、安裝LuaJit 1.下載LuaJit  http://luajit.org/download.html [[email protected]_6 source]$

Nginx-Lua模組的執行順序

一、nginx執行步驟 nginx在處理每一個使用者請求時,都是按照若干個不同的階段依次處理的,與配置檔案上的順序沒有關係,詳細內容可以閱讀《深入理解nginx:模組開發與架構解析》這本書,這裡只做簡單介紹; 1、post-read     讀取請求內容階段,ngin

nginxlua模組實現功能轉發

在$request_body你的if語句執行時,變數可能沒有被讀入記憶體。 建議的替代方法是使用lua支援或使用echo模組編譯nginx並執行echo_request_body。 I found the solution. I did following changes in ng

nginx 增加 lua模組

Nginx中的stub_status模組主要用於檢視Nginx的一些狀態資訊.  本模組預設是不會編譯進Nginx的,如果你要使用該模組,則要在編譯安裝Nginx時指定: ./configure –with-http_stub_status_module   這個模組如果需要

luajit+nginx+上傳模組+lua模組編譯安裝

git clone https://github.com/fdintino/nginx-upload-module.git git clone https://github.com/openresty/lua-nginx-module.git git clone https://github.com

已安裝nginx動態新增模組

http://www.cnblogs.com/lixigang/articles/5130052.html 說明: 已經安裝好的nginx,需要新增一個未被編譯安裝的模組,需要怎麼弄呢? 具體: 這裡以安裝第三方ngx_http_google_filter_modu

安裝成功的nginx如何新增未編譯安裝模組

原已經安裝好的nginx,現在需要新增一個未被編譯安裝的模組 舉例說明:安裝第三方的ngx_cache_purge模組(用於清除指定URL的快取) nginx的模組是需要重新編譯nginx,而不是像apache一樣配置檔案引用.so 1.wget http://l

使用yum安裝下的nginx新增模組的方法

前言 由於yum的方便性,有的時候我們對某些軟體的安裝無需特殊的需求時,通常是直接使用yum來安裝軟體。下面介紹的使用對使用yum安裝的nginx新增新模組的方法。 nginx新增第三方模組 nginx是不支援動態的安裝和新載入模組的。因此,如果

ubuntu18.04LTS下解決Nginx新增openssl模組編譯時報錯問題

ubuntu18.04LTS下解決Nginx新增openssl模組編譯時報錯問題 報錯提示 解決方法 第一步安裝libssl-dev 第二步下載libssl-dev 第三步修改編譯配置 最後一步編譯安裝

yum安裝下的nginx,如何新增模組,和新增第三方模組

需求:生產有個介面是通過socket通訊。nginx1.9開始支援tcp層的轉發,通過stream實現的,而socket也是基於tcp通訊。 實現方法:Centos7.2下yum直接安裝的nginx,新增新模組支援tcp轉發;重新編譯Nginx並新增 --with-stream 引數。 實現過程: 1.

centos7.2 原始碼編譯安裝nginx,實現tcp反向代理,不中斷服務新增編譯模組

   我們很多時候,需要將區域網內伺服器叢集中的某臺機器的某個埠對映到外網,可以直接通過代理伺服器連線到區域網內的電腦,進行操作。而nginx除了能實現http的反向代理外和負載均衡外,還能實現tcp的

在已有nginx新增模組以及在已有安裝包上編譯nginx

a:複製已有的安裝包 1,拷貝已有的安裝包 scp -r /root/soft [email protected]:/root/joeyon 2,編譯pcre與zlib需要編譯安裝 .

Nginx代理TCP請求模組新增及配置步驟

需求 Nginx 並不支援tcp協議,所以後端的一些基於TCP的業務就只能通過其他高可用負載軟體來完成了,如Haproxy。但在1.90釋出後增加了tcp代理模組,而老版本nginx需通過附加nginx_tcp_proxy_module實現TCP代理 環境 [[emai

nginx新增第三方模組以及啟用nginx自身的模組

    nginx不支援動態安裝、載入模組,所以如果需要安裝第三方模組或者啟動nginx自帶的模組功能需要重新安裝nginx,重新安裝nginx後,不會覆蓋原有的nginx的配置檔案,但是為了防止萬一,最好還是備份下來。安裝第三方模組的方法如下(以下以安裝http_stub_

PHPcms V9 新增模組 提示 phpcms v9 此模組未安裝或已禁用

新建PHPCMS V9模組的時候出現了這個問題–此模組已禁用或未安裝,檢視程式碼,沒有發現問題,也更新了快取,問題依舊,後面想了想,在_module表裡新增一個新條目,寫上新建的模組就好。 1、要在 phpcms 的 _module  表裡新增對應的模組的名字   就是