debian9、Raspbian安裝openresty

Raspbian是默認的最常用於Raspberry Pi的免費操作系統。Raspbian是基於Debian的一個版本(針對Raspberry Pi硬件Debian進行了專門的優化,並構建了超過35000個Raspbian包)。

首先第一步查看當前系統所處版本:

lsb_release -a

即不難知道我們當前系統可以參照debian 9穩定系統,知道系統版本,出問題也好比較容易定位。如下圖所示有個debian系統參照表:

第一步安裝依賴:

apt-get install libpcre3-dev \ libssl-dev perl make build-essential curl

若執行不成功,可以嘗試拆開分佈執行。

第二步下載openresty安裝版本:

這裏我們選用2017年版:

wget --no-check-certificate https://openresty.org/download/openresty-1.13.6.1.tar.gz

tar -xvf openresty-1.13.6.1.tar.gz

安裝組件:

cd openresty-1.13.6.1/bundle/LuaJIT-2.1-20171103/

make clean && make && make install

ln -sf luajit-2.1.0-alpha /usr/local/bin/luajit

當前目錄回到bundle:

cd ..

wget --no-check-certificate https://github.com/FRiCKLE/ngx_cache_purge/archive/2.3.tar.gz

tar -xvf 2.3.tar.gz

wget --no-check-certificate https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz

tar -xvf v0.3.0.tar.gz

 

安裝ngx_openresty:

cd openresty-1.13.6.1

./configure --prefix=/opt/work/openresty --with-http_realip_module --with-pcre --with-luajit --add-module=./bundle/ngx_cache_purge-2.3/ --add-module=./bundle/nginx_upstream_check_module-0.3.0/ -j2 --with-openssl=/opt/work/openssl-1.0.2l

--prefix爲編譯安裝路徑,後面with-openssl主要針對debian9默認openssl安裝版本不兼容openresty。

之後編譯安裝

make && make install

完成編譯後測試:

./nginx/sbin/nginx -t

nginx: the configuration file /opt/work/openresty/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /opt/work/openresty/nginx/conf/nginx.conf test is successful

說明安裝成功。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章