CentOS 安裝 OpenResty

方案一後端

一、在 CentOS 系統中添加 openresty 資源庫
sudo yum-config-manager --add-repo https://openresty.org/yum/cn/centos/OpenResty.repocentos

二、安裝 openresty
sudo yum install openresty併發


 

方案二高併發

用方案一安裝簡單,可是沒法安裝某些可選組件,好比lua性能

一、下載 wget https://openresty.org/download/openresty-1.11.2.3.tar.gzlua

二、解壓 tar -xzvf openresty-1.11.2.3.tar.gzurl

三、安裝依賴庫 yum install pcre-devel openssl-devespa

四、到解壓的目錄中執行設計

./configure --with-luajitrest

make

make install



OpenResty® 是一個基於 Nginx 與 Lua 的高性能 Web 平臺,其內部集成了大量精良的 Lua 庫、第三方模塊以及大多數的依賴項。用於方便地搭建可以處理超高併發、擴展性極高的動態 Web 應用、Web 服務和動態網關。

OpenResty® 經過匯聚各類設計精良的 Nginx 模塊(主要由 OpenResty 團隊自主開發),從而將 Nginx 有效地變成一個強大的通用 Web 應用平臺。這樣,Web 開發人員和系統工程師可使用 Lua 腳本語言調動 Nginx 支持的各類 C 以及 Lua 模塊,快速構造出足以勝任 10K 乃至 1000K 以上單機併發鏈接的高性能 Web 應用系統。

OpenResty® 的目標是讓你的Web服務直接跑在 Nginx 服務內部,充分利用 Nginx 的非阻塞 I/O 模型,不單單對 HTTP 客戶端請求,甚至於對遠程後端諸如 MySQL、PostgreSQL、Memcached 以及 Redis 等都進行一致的高性能響應。

你能夠在你的 CentOS 系統中添加 openresty 資源庫,這樣就能夠方便的安裝咱們的包,之後也能夠更新(經過 yum update 命令)。添加資源庫,你只用建立一個名爲 /etc/yum.repos.d/OpenResty.repo 的文件,內容以下:

[openresty]
name=Official OpenResty Repository
baseurl=https://copr-be.cloud.fedoraproject.org/results/openresty/openresty/epel-$releasever-$basearch/
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/openresty/openresty/pubkey.gpg
enabled=1
enabled_metadata=1

你也能夠直接運行 sudo yum-config-manager --add-repo https://openresty.org/yum/centos/OpenResty.repo 添加該文件。

中國大陸的用戶能夠把 baseurl 改爲下面的連接,速度會更快。

baseurl=https://openresty.org/yum/openresty/openresty/epel-$releasever-$basearch/

或者運行 sudo yum-config-manager --add-repo https://openresty.org/yum/cn/centos/OpenResty.repo 添加對應的文件。

列出 openresty 資源庫裏面全部的包:

sudo yum --disablerepo="*" --enablerepo="openresty" list available

而後你能夠安裝一個包,好比安裝 openresty, 像這樣:

sudo yum install openresty

相關文章
相關標籤/搜索