強(qiáng)大的 Web 應(yīng)?服務(wù)器OpenResty安裝(Nginx倉庫)
OpenResty(?稱:ngx_openresty) 是一個(gè)基于 NGINX 的可伸縮的 Web 平臺(tái),OpenResty 是?個(gè)強(qiáng)大的 Web 應(yīng)?服務(wù)器,Web 開發(fā)?員可以使用 Lua 腳本語?調(diào)動(dòng) Nginx ?持的各種 C 以及 Lua 模塊,更主要的是在性能方面,OpenResty可以快速構(gòu)造出足以勝任 10K 以上并發(fā)連接響應(yīng)的超高性能 Web 應(yīng)用系統(tǒng)
OpenResty® 是一個(gè)基于 Nginx 與 Lua 的高性能 Web 平臺(tái),其內(nèi)部集成了大量精良的 Lua 庫、第三方模塊以及大多數(shù)的依賴項(xiàng)。用于方便地搭建能夠處理超高并發(fā)、擴(kuò)展性極高的動(dòng)態(tài) Web 應(yīng)用、Web 服務(wù)和動(dòng)態(tài)網(wǎng)關(guān)。
OpenResty® 通過匯聚各種設(shè)計(jì)精良的 Nginx 模塊(主要由 OpenResty 團(tuán)隊(duì)自主開發(fā)),從而將 Nginx 有效地變成一個(gè)強(qiáng)大的通用 Web 應(yīng)用平臺(tái)。這樣,Web 開發(fā)人員和系統(tǒng)工程師可以使用 Lua 腳本語言調(diào)動(dòng) Nginx 支持的各種 C 以及 Lua 模塊,快速構(gòu)造出足以勝任 10K 乃至 1000K 以上單機(jī)并發(fā)連接的高性能 Web 應(yīng)用系統(tǒng)。
OpenResty® 的目標(biāo)是讓你的Web服務(wù)直接跑在 Nginx 服務(wù)內(nèi)部,充分利用 Nginx 的非阻塞 I/O 模型,不僅僅對(duì) HTTP 客戶端請(qǐng)求,甚至于對(duì)遠(yuǎn)程后端諸如 MySQL、PostgreSQL、Memcached 以及 Redis 等都進(jìn)行一致的高性能響應(yīng)。
OpenResty中?官網(wǎng): http://openresty.org/cn/
windows版安裝1.運(yùn)??個(gè)Hello World
在任意?個(gè)地?新建?個(gè)?件夾(注意最好不要有中?路徑)。例如:在桌面新建?個(gè) example 文件夾, ?錄結(jié)構(gòu)如下 (?錄樹生成網(wǎng)站 http://dir.yardtea.cc/)
2.其中l(wèi)ogs和conf是必要的,?面的?件可以新建空文件。
3.打開nginx.conf如?配置:
worker_processes 1;error_log logs/error.log;events { worker_connections 1024;}http { server {listen 9000;default_type text/html;location / { root /data/html; index kbn.html;}} }4.啟動(dòng)nginx
nginx -p /bin -c conf/nginx.conf或 cd /var/nginx/bin目錄使用 nginx -c conf/nginx.conf如果啟動(dòng)報(bào)錯(cuò) resty.core 找不到, 就把nginx安裝目錄中的lua,luaLib 兩個(gè)?件夾復(fù)制到project ?面去
5.修改配置之后使? ./nginx -s reload 重啟
停?./nginx -s stop
ConterOS 安裝 OpenResty下載地址:OpenResty官?: http://openresty.org/OpenResty下載地址:http://openresty.org/cn/download.html
安裝依賴庫:$ yum install -y pcre-devel openssl-devel gcc curl2.下載OpenResty版本:
$ wget https://openresty.org/download/openresty-1.15.8.1.tar.gzwget https://openresty.org/download/openresty-1.21.4.1.tar.gz解壓: $ tar -xzvf openresty-1.15.8.1.tar.gz進(jìn)?解壓?目錄:$ cd openresty-1.15.8.1/檢查配置環(huán)境, ?成 Makefile,默認(rèn)安裝到/usr/local/openresty:$ ./configure編譯安裝:$ gmake && gmake install安裝結(jié)果:
mkdir -p /usr/local/openresty/site/lualib /usr/local/openresty/site/pod /usr/local/openresty/site/manifestln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/openresty/bin/openresty可以看到openresty 實(shí)際上是nginx的軟連接。7.常用命令:
查看版本號(hào):$ /usr/local/openresty/bin/openresty -v nginx version: openresty/1.15.8.3檢驗(yàn)配置/usr/local/openresty/bin/openresty -t啟動(dòng)/usr/local/openresty/bin/openresty停?/usr/local/openresty/bin/openresty -s stop重新加載配置/usr/local/openresty/bin/openresty -s reload配置/lib/systemd/system/openresty.service,通過systemctl啟動(dòng):[Unit]Description=openresty - high performance web serverAfter=network.target remote-fs.target nss-lookup.target[Service]Type=forkingExecStart=/usr/local/openresty/bin/openresty -c /usr/local/openresty/nginx/conf/nginx.confExecReload=/usr/local/openresty/bin/openresty -s reloadExecStop=/usr/local/openresty/bin/openresty -s stop[Install]WantedBy=multi-user.target9.添加openresty.service后,使配置文件生效:
$ systemctl daemon-reload10.使用systemctl管理openresty:
啟動(dòng)$ systemctl start openresty停?$ systemctl stop openresty重載配置$ systemctl reload openresty重啟$ systemctl restart openresty到此這篇關(guān)于強(qiáng)大的 Web 應(yīng)?服務(wù)器OpenResty安裝(Nginx倉庫) 的文章就介紹到這了,更多相關(guān)安裝OpenResty內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. linux中數(shù)據(jù)庫的定時(shí)備份2. nginx?反向代理負(fù)載均衡策略配置SSL訪問匹配規(guī)則優(yōu)先級(jí)3. linux所有命令都失效顯示bash: xxxxx: command not found的解決4. win11下FTP服務(wù)器搭建圖文教程5. Linux系統(tǒng)開機(jī)從BIOS到登錄環(huán)境過程6. linux掛載本地yum源問題7. 關(guān)于Linux搭建RabbitMQ集群環(huán)境圖文詳解8. shell腳本實(shí)戰(zhàn)之部署nginx腳本實(shí)例9. Tomcat請(qǐng)求處理流程與源碼淺析(最新推薦)10. 淺談Tomcat內(nèi)存配置的正確姿勢(shì)
