Add the homebrew/nginx tap.
$ brew tap homebrew/nginx
Install openresty from homebrew.
$ brew install openresty
Install the LuaRocks package manager.
$ brew install luarocks
Install Lapis.
$ luarocks install lapis
Install Moonscript (optional).
$ luarocks install moonscript
Lapis looks for the Openresty nginx binary in these locations:
"/usr/local/openresty/nginx/sbin/"
"/usr/local/opt/openresty/bin/"
"/usr/sbin/"
""
But the homebrew Openresty nginx binary is called openresty
, not nginx
. To tell Lapis where to look for the Openresty nginx binary we can set the LAPIS_OPENRESTY
environment variable to the nginx path; which openresty
, and then run the server with lapis server
.
LAPIS_OPENRESTY=$(which openresty) lapis server
Openresty requires lua 5.1 not 5.2
Because docker uses linux container which aren't available on OS X we'll need to run docker inside of a linux virtual machine. Docker provides a Boot2Docker app for this reason, but we'll use Vagrant instead.
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.provider "docker" do |d|
d.image = "jchaney/openresty-nginx"
end
config.vm.network "public_network"
config.vm.provision "shell", inline: "lapis server production"
end
Docker needs a process to run, otherwise it will imediately exit.