Openresty 安装与 Hello World,


一、Openresty 介绍

OpenResty 是一个基于 Nginx 与 Lua 的高性能 Web 平台,集成许多优良的 Lua 库、第三方模块等。

可以快速构建出足以胜任 10K 甚至 1000K 单机并发连接的高性能 Web 应用系统

二、安装 Openresty

找到最新的安装包 https://openresty.org/cn/download.html ,如:openresty-1.13.6.2.tar.gz

tar -xzvf openresty-VERSION.tar.gz

cd openresty-VERSION/

./configure --with-luajit \
            --with-http_iconv_module \

make && make install

三、Hello World DEMO

新建一个文件夹 work,下面创建 logs/ conf/ 子文件夹

vim conf/nginx.conf
worker_processes  1;
error_log logs/error.log;
events {
    worker_connections 1024;
}
http {
    server {
        listen 8080;
        location / {
            default_type text/html;
            content_by_lua '
                ngx.say("<p>hello, world</p>")
            ';
        }
    }
}

保存后

cd /usr/local/openresty/nginx/sbin

./nginx -c /root/work/conf/nginx.conf

四、查看 Hello World 确认 Openresty 安装成功

curl http://localhost:8080/

# 可见 <p>hello</p> 代表 openresty 安装成功

 

相关内容

    暂无相关文章