下載openresty
wget https://openresty.org/download/openresty-1.15.8.1.tar.gz
tar zxvf openresty-1.15.8.1.tar.gz
cd 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
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/153347.html
標籤:Linux
上一篇:如何在linux終端創建檔案
