Environment: Mac, Brew installation
Brew installation is very convenient, and you can run nginx directly after the installation is completed.
Install nginx
brew install nginx-full - -with-lua-module
The following module options can be viewed through the following command:
brew options nginx-full
<code>--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 ....</code>
If the installation is wrong or you want to Try something else, you can uninstall and reinstall
brew uninstall nginx-full
(If you need to install other dependencies in the middle, you can install them through brew. Because I have been tinkering with it for a long time, I am not sure if I need to install anything else)
Use lua
Create a new lua.conf file and put it under /usr/local/etc/nginx/conf. conf is a newly created folder
<code>#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>; } }</code>
If you don’t have lua51, just install it through brew
brew install lua51
Introduction
Introduce the file under the http module of the nginx.config file (you can specify the location yourself)
include conf/*.conf;
Test
nginx -t
<code> 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</code>
localhost:8083/lua –>hello world
If you have any questions, please leave a message
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });The above introduces the installation of lua module by nginx-Brew, including the content of nginx and brew. I hope it will be helpful to friends who are interested in PHP tutorials.