登录  /  注册
nginx-Brew安装lua模块 brew nginx php mac brew nginx 安装 brew nginx php mysq
php中文网
发布: 2016-07-29 08:53:58
原创
1013人浏览过

环境:Mac、Brew安装

brew安装很方便,安装完成后可以直接运行nginx的。


安装nginx

brew install nginx-full - -with-lua-module

后面的module选项可以通过如下命令查看:

brew options nginx-full

--with-accept-language-module
    Compile with support for Accept Language module
--with-accesskey-module
    Compile with support for HTTP Access Key module
--with-addition
    Compile with support for HTTP Addition module
--with-lua-module
    Compile with support for LUA module
    ....
登录后复制

如果安装错误或者想尝试下别的,可以卸载重装

brew uninstall nginx-full

(中途若需要安装其它依赖,都可以通过brew安装。因为鼓捣了好久,不确定是不是还需要安装别的)


使用lua

新建lua.conf文件,放到/usr/local/etc/nginx/conf下,conf是新建的文件夹

#lua.conf
lua_package_path '/usr/local/Cellar/lua51/5.1.5_4/lib/?.lua;;';  #lua 模块
lua_package_cpath '/usr/local/Cellar/lua51/5.1.5_4/lib/?.so;;';  #c模块

server {
    listen       8083;
    server_name  localhost;

    location /lua{
        default_type 'text/html';
        content_by_lua 'ngx.say("hello world")';
    }
}
登录后复制

若没有lua51,通过brew安装就好

brew install lua51


引入

在nginx.config文件的http模块下引入文件(可以自己指定位置)

include conf/*.conf;


测试

nginx -t

 nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
 nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
登录后复制

localhost:8083/lua –>hello world

有问题欢迎留言

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了nginx-Brew安装lua模块,包括了nginx,brew方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

  • 相关标签:
    来源:php中文网
    本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
    热门教程
    更多>
    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责申明 意见反馈 讲师合作 广告合作 技术文章
    php中文网:公益在线php培训,帮助PHP学习者快速成长!
    关注服务号 技术交流群
    PHP中文网订阅号
    每天精选资源文章推送
    PHP中文网APP
    随时随地碎片化学习
    PHP中文网抖音号
    发现有趣的

    Copyright 2014-2023 //m.sbmmt.com/ All Rights Reserved | 苏州跃动光标网络科技有限公司 | 苏ICP备2020058653号-1

     | 本站CDN由 数掘科技 提供

    登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学