平台及版本

OS: CentOS 7
OpenResty: OpenResty

第三方依赖及库

yum install readline-devel pcre-devel openssl-devel perl luajit luajit-devel

编译安装

./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module
gmake && gmake install

设置环境变量

vim /etc/profile
# 文件末尾添加
export PATH=$PATH:/opt/openresty/nginx/sbin
source /etc/profile
# 校验
nginx -V 

创建工作目录及测试

mkdir ~/openresty ~/openresty/conf ~/openresty/logs
# 创建nginx.conf
vim ~/openresty/conf/nginx.conf

# 启动
nginx -p ~/openresty
# 重启
nginx -s reload -p ~/openresty

# 测试
curl http://localhost:1920/ -i
# nginx.conf
worker_processes 1; #nginx worker 数量
error_log logs/error.log; #指定错误日志文件路径
events {
    worker_connections 1024;
}

http {
    server {
        #监听端口,若你的6699端口已经被占用,则需要修改
        listen 1920;
        location / {
            default_type text/html;
            content_by_lua_block {
                ngx.say("Hello Lua.")
            }
        }
    }
}