openresty又被稱為ngx_openresty,是基于nginx的核心web應用程序服務器,openresty是基于nginx和lua的高性能web平臺,openresty通過匯聚各種設計精良的nginx模塊,從而將nginx有效地變成一個強大的通用web應用平臺。

下載openresty
wget?https://openresty.org/download/openresty-1.15.8.1.tar.gz tar?zxvf?openresty-1.15.8.1.tar.gzcd?openresty-1.15.8.1
安裝openresty
查看當前nginx的編譯配置
nginx?-V
如下所示,”configure arguments”就是編譯nginx時的配置
nginx?version:?nginx/1.14.0 built?by?gcc?4.8.5?20150623?(Red?Hat?4.8.5-39)?(GCC) built?with?Openssl?1.0.2k-fips??26?Jan?2017 TLS?SNI?support?enabled configure?arguments:?--with-http_ssl_module
編譯openresty,把剛才的配置加到”configure”命令后方,如果需要使用lua也可以加上”–with-luajit”
./configure?--with-http_ssl_module?--with-luajit gmake?&&?gmake?install
gmake即gnu make,使用它的原因是非GNU平臺可能占用了make命令,在linux系統下不用考慮這個問題。GNU,在unix系統發明后,開始出現閉源收費軟件,于是有人發起了自由軟件的計劃,即GNU計劃,宣揚開源精神,編輯器emacs和編譯器GCC就屬于GNU下的項目,但是GNU下缺少系統內核,后來機緣巧合地與Linux進行了合作,發布了GNU/Linux。
更換配置文件
把原有nginx配置文件移動到openresty目錄
mv?/usr/local/nginx/conf/*.conf?/usr/local/openresty/conf mv?/usr/local/nginx/conf/conf.d?/usr/local/openresty/conf
停止原nginx
nginx?-s?stop
啟動openresty
/usr/local/openresty/bin/openresty
如果提示”nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl””,原因是nginx1.15版本及以后已經不需要使用ssl on命令了,可以去掉。
軟鏈接到bin目錄
如果覺得命令使用不方便可以直接軟鏈接到bin目錄,并改名為nginx
ln?-s?/usr/local/openresty/bin/openresty?/usr/local/bin/nginx
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END