1. 程式人生 > >原始碼安裝nginx並配置Lua模組

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

今天需要在測試機佈置nginx測試環境,測試機不能聯網。所以只能用scp上傳nginx原始碼安裝。期間遇到不少問題

1.下載nginx原始碼

$wget 'http://sysoev.ru/nginx/nginx-1.2.6.tar.gz'

2.下載lua-nginx-module原始碼

$git clone https://github.com/chaoslawful/lua-nginx-module.git

$tar zcvf lua-nginx-module

//上傳到測試機

//$scp -p nginx-1.2.6.tar.gz port [email protected]:nginx-1.2.6.tar.gz

3.編譯nginx

$tar -zxvf nginx-1.2.6.tar.gz

$cd nginx-1.2.6.tar.gz

$configure --add-module=/root/lua-nginx-module

提示找不到lua庫

安裝lua原始碼。在lua.org官方主頁下載原始碼,一開始我直接下的最新版,最後才發現:

4.下載lua原始碼

$wget http://www.lua.org/ftp/lua-5.1.5.tar.gz

$tar -zxvf lua-5.1.5.tar.gz

$make linux

gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lua.o lua.c
在包含自 lua.h:16 的檔案中,
                 從 lua.c:15:
luaconf.h:275:31: 錯誤:readline/readline.h:沒有那個檔案或目錄
luaconf.h:276:30: 錯誤:readline/history.h:沒有那個檔案或目錄

5.安裝readline

$wget ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz

$tar -zxvf readline-6.2.tar.gz

$./configure

$make install

再重新編譯lua, 提示-lncurses失敗,也就是沒有ncurses庫

/usr/bin/ld: cannot find -lncurses
collect2: ld 返回 1
make[2]: *** [lua] 錯誤 1
make[2]: Leaving directory `/root/lua-5.1.5/src'
make[1]: *** [linux] 錯誤 2
make[1]: Leaving directory `/root/lua-5.1.5/src'
make: *** [linux] 錯誤 2

6.安裝ncurses

$wget ftp://invisible-island.net/ncurses/ncurses-5.9.tar.gz

$tar -zxvf ncurses-5.9.tar.gz

$./configure

$make & make install

執行到中途,提示:

/bin/sh: -I../c++: 沒有那個檔案或目錄
make[1]: *** [../objects/cursesf.o] 錯誤 127
make[1]: Leaving directory `/root/ncurses-5.9/c++'
make: *** [all] 錯誤 2

這個問題糾結了好長時間,在http://forums.gentoo.org/viewtopic-p-2641060.html找到相關的,但是發現是gentoo系統。不過也試了試安裝g++,下載g++原始碼時發現完整的包有78M,就偷懶下了個gcc-g++-xxx.tar.gz。最後解壓發現不完整,根本不能編譯。

If you don't have a c++ compilter, try adding --without-cxx to your
./configure line.
安裝ncurse $./configure --without-cxx

$make & make install

7.安裝nginx(因為主要目的是測試lua模組,所以沒安裝http_rewrite模組和http_gzip模組)

$./configure --add-module=/root/lua-nginx-module --without-http_rewrite_module --without-http_gzip_module

$make install 

提示

/usr/local/lib/liblua.a(loadlib.o): In function `ll_loadfunc':
loadlib.c:(.text+0x7d4): undefined reference to `dlsym'
loadlib.c:(.text+0x7e2): undefined reference to `dlerror'
loadlib.c:(.text+0x8ad): undefined reference to `dlopen'
loadlib.c:(.text+0x8c3): undefined reference to `dlerror'
/usr/local/lib/liblua.a(loadlib.o): In function `gctm':
loadlib.c:(.text+0xdbc): undefined reference to `dlclose'
collect2: ld 返回 1
make[1]: *** [objs/nginx] 錯誤 1
make[1]: Leaving directory `/root/nginx-1.2.7'
make: *** [install] 錯誤 2

終於搞定!

後記:

因為要使用set指令,無奈必須安裝rewrite模組。

又需要安裝 pcre, g++, gmp,mpfr,mpc ...

安裝g++

checking for x86_64-unknown-linux-gnu-gcc... /root/gcc-4.6.1/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/root/gcc-4.6.1/host-x86_64-unknown-linux-gnu/gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include   
checking for suffix of object files... configure: error: in `/root/gcc-4.6.1/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] 錯誤 1
make[2]: Leaving directory `/root/gcc-4.6.1'
make[1]: *** [stage1-bubble] 錯誤 2
make[1]: Leaving directory `/root/gcc-4.6.1'
make: *** [all] 錯誤 2

http://gcc.gnu.org/wiki/FAQ#configure_suffix

相關推薦

原始碼安裝nginx配置Lua模組

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

在centos 7中安裝nginx配置nginx反向代理

nginx linux proxy 反向代理 Nginx是一款輕量級的Web 服務器/反向代理服務器及電子郵件(IMAP/POP3)代理服務器,並在一個BSD-like 協議下發行。其特點是占有內存少,並發能力強,事實上nginx的並發能力確實在同類型的網頁服務器中表現較好,中國大陸使用ngi

Linux下安裝Nginx配置一個圖片服務器

com log 僅支持 centos6 str 技術分享 .html agent remote 首先安裝nginx安裝環境 nginx是C語言開發,建議在linux上運行,本教程使用Centos6.5作為安裝環境。 --> gcc 安裝nginx需要先將官網下載的

阿里雲Linux Ubentu 安裝 Nginx配置https

下載nginx:    wget http://nginx.org/download/nginx-1.8.0.tar.gz 下載openssl : wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz 下載zl

Ubuntu安裝nginx配置應用

安裝gcc g++的依賴庫 1 2 apt-get install build-essential apt-get install libtool centeros平臺可以使用如下命令。 1 2 3 4

CentOS 7 安裝Nginx 配置自動啟動

1、官網下載安裝包     http://nginx.org/en/download.html,選擇適合Linux的版本,這裡選擇最新的版本,下載到本地後上傳到伺服器或者centos下直接wget命令下載。     切換到/usr/local目錄,下載軟體包

安裝nginx配置相關的環境變數

1.   準備工作:首先下載Linux(連結:https://pan.baidu.com/s/1qXTPrWS 密碼: euv6)版本的Nginx,假設我們在安裝伺服器上建立soft目錄 用來存放安裝所需的軟體命令:mkdir/app,然後將下載的linux版本的Nginx

使用docker安裝nginx配置埠轉發

使用docker安裝並執行nginx命令:  docker run --name=nginx -p 80:80 -d docker.io/nginx   使用命令: docker exec -it nginx /bin/bash 進入容器可檢視到幾個重要的檔案   配置檔案:ng

docker 安裝nginx掛載配置文件和www目錄以及日誌目錄

gin bsp 恢復 容器 名稱 內容 文件 etc dock ---恢復內容開始--- 一 首先 docker pull nginx 二 docker run --name myNginx -d -p 80:80 -v e:/docker/nginx/www

virtualBox安裝centos7配置nginx php mysql運行環境

save 修改內容 may so文件 連接 添加 http訪問 文章 下載地址 virtualBox安裝centos7並配置nginx php mysql運行環境 一:virtualBox安裝centos7並進行基礎設置 1.下載dvd.iso安裝文件,下載地址:htt

ubuntu16.04安裝docker配置php7+nginx環境

安裝docker 前提條件 Docker 要求 Ubuntu 系統的核心版本高於 3.10 通過 uname -r 命令檢視你當前的核心版本 ubuntu映象下載地址 本人下載的是ubuntu-16.04.5-desktop-amd64.iso 用VMware workstati

OpenSSL原始碼安裝後路徑配置(解決Nginx編譯時 openssl not found問題)

有時候因為nginx升級之後使用了高版本的Openssl,本地需要新增新模組重新編譯nginx時候要升級openssl至指定版本。 原始碼安裝Openssl之後重新編譯Nginx會報如下錯誤: checking for OpenSSL library ... not fo

centerOS 6.5安裝nginx新增nginx-upload-module斷點續傳模組

第一步:安裝nginx: 1,如果沒有安裝pcre和openssl需要先安裝: yum -y install pcre* yum -y install openssl* 2,下載nginx-1.7.8,例如我的nginx下載在

Git使用:Linux(Ubuntu 14.04 x64)下安裝GIt配置連接GitHub

成功 ger 版本 style sts via xxxxxxxx apt 安裝 github是一個非常好的網絡代碼托管倉庫,知曉許久,但是一直沒有用起來,最近才開始使用git管理自己的文檔和代碼。 Git是非常強大的版本管理工具,今天就告訴大家,如何在Linux下安裝GIt

linux下安裝redis配置

ext find 客戶 bin extract write sometimes group gin redis官網上給出了安裝步驟,這裏做一下總結。 1、Download, extract and compile Redis with: wget http://downl

【轉載】centos7 關閉firewall防火墻指令以及更換安裝iptables配置

ref stat con bsp comm 關閉 art output lis 轉載連接 http://ashui.net/archives/2015/943.html 一、配置防火墻,開啟80端口、3306端口 CentOS 7.0默認使用的是firewall作為防火

WIN7 64位系統安裝JDK配置環境變量

自己 驗證 下載 存放位置 platform gre jpg 高級 win7 64 1、首先,下載JDK安裝包,到官網http://www.oracle.com/technetwork/java/javase/downloads/index.html進行下載,點左邊的Jav

centos7 關閉firewall安裝iptables配置

sysconfig 關閉selinux 配置文件 設置 wid linux state accep res 一、配置防火墻,開啟80端口、3306端口 CentOS 7.0默認使用的是firewall作為防火墻,這裏改為iptables防火墻。

php源碼安裝配置apache支持php

cannot .html openssl director link sql html ech rod 一、php安裝準備環境 yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-de

使用shell腳本一鍵安裝zabbix配置客戶端的自動發現選項

監控 shell zabbix 自動註冊 zabbix_agent 1.緣由: 我自己的ESXi服務器上上最近新加了好多虛擬主機,但我現在還不會安裝,使用,那種批量運維工具(saltstack,ansible,puppet等)。雖然還有一種方法:就是通過shell工具一次打開