• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

[openresty] hello world

php 搞代码 3年前 (2022-01-23) 23次浏览 已收录 0个评论

[openresty] hello world

openresty软件部署

不说了,和nginx差不多的。

content_by_lua指令

可以用content_by_lua指令将一段lua代码包含到nginx里面去执行,比如下面最简单的调用ngx.say来输出Hello world。

<code>    location / {            default_type <span>text</span>/html;            content_by_lua '                ngx.<span>say</span>(<span>"<p>hello,<em>/本2文来源[email protected]搞@^&代*@码2网</em><strong>搞gaodaima代码</strong> world</p>"</span>)            ';        }</code>

长一些的代码适合用rewrite_by_lua_file

后面就跟一个path路径

<code>    location / {                content_by_lua_file lua/hello.lua;        }[root<span>@test</span> nginx]<span># cat lua/hello.lua</span>ngx.<span>say</span>(<span>"<p>hello, world!!! hey man</p>"</span>)        </code>

lua_code_cache

默认nginx对lua代码段有一层缓存,提高了效率,但是这也让我们每次修改完lua以后需要reload nginx才能生效,这时候我们可以关掉cache,实时生效,等调试完毕以后再打开。

<code>lua_code_cache <span>off</span>;</code>

‘).addClass(‘pre-numbering’).hide(); $(this).addClass(‘has-numbering’).parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('

  • ‘).text(i)); }; $numbering.fadeIn(1700); }); }); </script>

    以上就介绍了[openresty] hello world,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。


    搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
    转载请注明原文链接:[openresty] hello world

    喜欢 (0)
    [搞代码]
    分享 (0)
  • 发表我的评论
    取消评论

    表情 贴图 加粗 删除线 居中 斜体 签到

    Hi,您需要填写昵称和邮箱!

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址