macos搭建openresty开发环境,


工具:

  • IDE:IntelliJ IDEA 2018.3.5 (Ultimate Edition)+EmmyLua插件
  • macOS 专用模块管理工具: Homebrew 1.3.6
  • openresty/1.13.6.2

安装homebrew:

brew官网

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装openresty

官方地址

brew install openresty/brew/openresty

如果已经通过homebrew/nginx安装openresty,需先执行以下命令

brew untap homebrew/nginx

idea安装EmmyLua插件

创建项目

创建普通Lua项目 
New-Project,然后next,填项目名、路径,点击finish。 
在项目视图的src文件夹New一个test.lua文件

---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by zhangyunpeng.
--- DateTime: 2019-04-02 16:55
---
local base_home = "/Library/Programes/workspace-me/luaDemo/"
package.path = package.path  .. ";" .. base_home .. "lua/?.lua;" .. base_home .. "lualib/?.lua;;"
package.cpath = package.path  .. ";"  .. base_home .. "lualib/?.so;;"
ngx.say("hello word!")

执行run设置Program

结果

demo地址

https://github.com/HiMrZhang/openresty-project.git

相关内容

    暂无相关文章