首頁 > 運維 > Nginx > 主體

openresty怎麼換nginx

WBOY
發布: 2023-05-16 22:10:05
轉載
1172 人瀏覽過

OpenResty又被稱為ngx_openresty,是基於Nginx的核心Web應用程式伺服器,OpenResty是基於Nginx和Lua的高效能Web平台,OpenResty透過匯聚各種設計精良的Nginx模組,從而將Nginx有效地變成一個強大的通用Web應用平台。

openresty怎麼換nginx

下載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
登入後複製

以上是openresty怎麼換nginx的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:yisu.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!