openresty 1.15.8.1html
官方:https://openresty.org/en/nginx
OpenResty® is a dynamic web platform based on NGINX and LuaJIT.web
openresty是一個基於nginx和luajit的動態web平臺;docker
OpenResty® is a full-fledged web platform that integrates the standard Nginx core, LuaJIT, many carefully written Lua libraries, lots of high quality 3rd-party Nginx modules, and most of their external dependencies. It is designed to help developers easily build scalable web applications, web services, and dynamic web gateways.服務器
openresty是一個豐富的web平臺,將標準nginx內核、luajit、多個lua庫,多個第三方nginx模塊以及依賴整合在一塊兒;app
By taking advantage of various well-designed Nginx modules (most of which are developed by the OpenResty team themselves), OpenResty® effectively turns the nginx server into a powerful web app server, in which the web developers can use the Lua programming language to script various existing nginx C modules and Lua modules and construct extremely high-performance web applications that are capable to handle 10K ~ 1000K+ connections in a single box.curl
利用設計良好的nginx模塊,openresty將nginx高效的變爲一個web應用服務器,開發者能夠經過lua來調用nginx模塊和lua模塊,而且構建極端高效的web應用,輕鬆應用10k-1000k的鏈接數;ide
OpenResty® aims to run your server-side web app completely in the Nginx server, leveraging Nginx's event model to do non-blocking I/O not only with the HTTP clients, but also with remote backends like MySQL, PostgreSQL, Memcached, and Redis.測試
openresty使你的服務端應用徹底運行在nginx上,而且將nginx的事件模型應用到不少方面;ui
Real-world applications of OpenResty® range from dynamic web portals and web gateways, web application firewalls, web service platforms for mobile apps/advertising/distributed storage/data analytics, to full-fledged dynamic web applications and web sites. The hardware used to run OpenResty® also ranges from very big metals to embedded devices with very limited resources. It is not uncommon for our production users to serve billions of requests daily for millions of active users with just a handful of machines.
OpenResty® is not an Nginx fork. It is just a software bundle. Most of the patches applied to the Nginx core in OpenResty® have already been submitted to the official Nginx team and most of the patches submitted have also been accepted. We are trying hard not to fork Nginx and always to use the latest best Nginx core from the official Nginx team.
openresty不是一個nginx分支,它只是一個軟件的組合包;
tar -xvf openresty-VERSION.tar.gz
cd openresty-VERSION/
./configure -j2
make -j2
sudo make install
參考:https://openresty.org/en/installation.html
$ docker run -d --name resty -p 80:80 host openresty/openresty
參考:https://hub.docker.com/r/openresty/openresty
訪問:http://127.0.0.1:80
默認的nginx.conf位於 /usr/local/openresty/nginx/conf/nginx.conf (不是 /etc/nginx/nginx.conf),默認會加載全部/etc/nginx/conf.d/下的配置文件
include /etc/nginx/conf.d/*.conf;
準備測試配置
# cat testlua.conf
server {
listen 80;
server_name testlua;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
啓動
# docker run -d --name resty -p 80:80 -v /path/testlua.conf:/etc/nginx/conf.d/testlua.conf openresty/openresty
測試
# curl http://testlua -x 127.0.0.1:80<p>hello, world</p>