环境搭建完成后,修改 nginx.conf 文件,实现 页面打印 Hello World
配置 如下:
# 在 server 下加入新的 location
location /hello-world {
default_type "text/plain";
content_by_lua_block {
ngx.say("Hello World!")
}
}
启动 Nginx 后验证结果:
$ curl 'http://localhost/hello-world'
Hello World!