用lua写个hello world

环境说明

  • centos 7.9
  • openresty 1.21.4.1 

安装openresty

参考:centos7.9安装openresty_黄娟0229的博客-CSDN博客

nginx配置

location /lua {
    default_type text/html;
    content_by_lua '
        ngx.say("<p>Hello world</p>")
    ';
}

重启nginx

# 测试配置文件是否正确
/usr/local/openresty/nginx/sbin/nginx -t
# 重启nginx
/usr/local/openresty/nginx/sbin/nginx -s reload

访问 localhost:80/lua

猜你喜欢

转载自blog.csdn.net/huangjuan0229/article/details/130804940
今日推荐