安裝openresty1.9

openresty

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 等都進行一致的高性能響應。
html

下載openresty

[root@web-001 ~]# wget https://openresty.org/download/openresty-1.9.15.1.tar.gz

安裝前的準備

您必須將這些庫 perl 5.6.1+libreadlinelibpcrelibssl安裝在您的電腦之中。 對於 Linux來講, 您須要確認使用 ldconfig 命令,讓其在您的系統環境路徑中能找到它們。nginx

Debian 和 Ubuntu 用戶

推薦您使用 apt-get安裝如下的開發庫:web

apt-get install libreadline-dev libncurses5-dev libpcre3-dev \    libssl-dev perl make build-essential

Fedora 和 RedHat 用戶

推薦您使用yum安裝如下的開發庫:後端

yum install readline-devel pcre-devel openssl-devel gcc

安裝opneresty

[root@web-001 ~]# tar fxz openresty-1.9.15.1.tar.gz 
[root@web-001 ~]# cd openresty-1.9.15.1
[root@web-001 openresty-1.9.15.1]# ./configure
[root@web-001 openresty-1.9.15.1]# make
[root@web-001 openresty-1.9.15.1]# make install

注:默認, --prefix=/usr/local/openresty 程序會被安裝到/usr/local/openresty目錄。併發

啓動openresty

[root@web-001 ~]# /usr/local/openresty/nginx/sbin/nginx

查看

[root@web-001 ~]# ss -antp|grep nginx
LISTEN     0      128                       *:80                       *:*      users:(("nginx",10794,6),("nginx",10793,6))

驗證下是否提供服務

[root@web-001 ~]# curl -I http://127.0.0.1
 HTTP/1.1 200 OK
 Server: openresty/1.9.15.1
 Date: Sat, 25 Jun 2016 23:03:55 GMT
 Content-Type: text/htmlContent-Length: 612
 Last-Modified: Sat, 25 Jun 2016 23:03:29 GMT
 Connection: keep-alive
 ETag: "576f0dc1-264
 "Accept-Ranges: bytes

中止服務

[root@web-001 ~]# /usr/local/openresty/nginx/sbin/nginx -s stop

openrest環境變量

[root@web-001 ~]# echo PATH=$PATH:/usr/local/openresty/nginx/sbin/ >> /etc/profile
[root@web-001 ~]# source /etc/profile

關閉版本顯示

server_tokens off;     #關閉版本顯示

注:吧上面內容放在http段便可,而後從新檢查語法以及重載便可curl

檢查語法

[root@web-001 ~]# nginx -t
nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful
相關文章
相關標籤/搜索