One working solution – Lua wsapi with nginx in debian/ubuntu

You need to install luarocks, nginx before followin steps, and should run as root.

1) luarocks install wsapi-xavante

Then find the wsapi command, in my installation, it is under /usr/local/bin/wsapi

it is a shell script, looks like:

2) try to create one lua folder in your nginx content folder, such as “/var/www/nginx-default/” or “/usr/local/nginx/html/”

For example, if your folder is /var/www/nginx-default/lua, change current directory to this folder, write one lua file, name is “hello.lua”:

You could find reference how to write wsapi lua in

3) run command: /usr/local/bin/wsapi –p 8085

Opening browser and go to 

You should able to see:

Hello Wsapi!


SCRIPT_NAME: /hello.lua

4) change nginx.conf, add following:

location ~ \.lua$ {



5) pkill lua, then run “/usr/local/bin/wsapi –p 8085 &” in folder /var/www/nginx-default/lua

Restart nginx.

6) go to, it should work now.