环境:mac、brew安装
brew安装很方便,安装完成后可以直接运行nginx的。
安装nginx
brew install nginx-full - -with-lua-module
后面的module选项可以通过如下命令查看:
brew options nginx-full
立即学习“PHP免费学习笔记(深入)”;
--with-accept-language-module Compile with support <span>for</span> Accept Language module --with-accesskey-module Compile with support <span>for</span> HTTP Access Key module --with-addition Compile with support <span>for</span> HTTP Addition module --with-lua-module Compile with support <span>for</span> LUA module ....
如果安装错误或者想尝试下别的,可以卸载重装
brew uninstall nginx-full
(中途若需要安装其它依赖,都可以通过brew安装。因为鼓捣了好久,不确定是不是还需要安装别的)
使用lua
新建lua.conf文件,放到/usr/local/etc/nginx/conf下,conf是新建的文件夹
#lua.conf lua_package_path <span>'/usr/local/Cellar/lua51/5.1.5_4/lib/?.lua;;'</span>; #lua 模块 lua_package_cpath <span>'/usr/local/Cellar/lua51/5.1.5_4/lib/?.so;;'</span>; #c模块 server { listen <span>8083</span>; server_name localhost; location /lua{ default_type <span>'text/html'</span>; content_by_lua <span>'ngx.say("hello world")'</span>; } }
若没有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 ').text(i)); }; $numbering.fadeIn(1700); }); });以上就介绍了nginx-Brew安装lua模块,包括了nginx,brew方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号