- 时间:2022-09-04 01:08 编辑: 来源: 阅读:290
- 扫一扫,手机访问
摘要:[nginx]十四。nginx高阶开运算的helloworld
《电影网站源码》
上一篇文章,老顾给大家详细介绍了openresty的安装。按照常规方式的细节,我们先来举一个helloworld的案例,对openresty有个初步的印象。 进入openresty安装目录,在nginx目录下的conf配置目录中编辑nginx.conf配置文件# vininx.conf,在服务器指令板中添加helloworld路由位置/hello world { default _ typetext/html;content_by_lua:ngx . say(" hello world ");;}退出并保存检查配置文件是否正确#/usr/local/openresty/nginx/sbin/nginx-t-c/usr/local/openresty/nginx/conf/nginx . conf重启nginx#。/nginx -s重载访问http://192 . 168 . 31 . 138/hello world输出hello world有一个指令content _ by _ Lua \在服务器部分。ngx . say(" hello world ");;从字面上看,你可以猜测,content_by_lua。该指令意味着使用lua指令输出内容。ngx.say是Lua打包的打印指令。这个案例是在界面上打印helloworld内容。老顾先到这里详谈;下面带你慢慢了解openresty的特性。