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
查看當前nginx的編譯配置linux
nginx -V
以下所示,"configure arguments"就是編譯nginx時的配置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"bash
./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目錄ui
mv /usr/local/nginx/conf/*.conf /usr/local/openresty/conf mv /usr/local/nginx/conf/conf.d /usr/local/openresty/conf
nginx -s stop
/usr/local/openresty/bin/openresty
若是提示"nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl"",緣由是nginx1.15版本及之後已經不須要使用ssl on命令了,能夠去掉。lua
若是以爲命令使用不方即可以直接軟連接到bin目錄,並更名爲nginxrest
ln -s /usr/local/openresty/bin/openresty /usr/local/bin/nginx