I'm trying to serve two (Openresty) Lua web applications as virtual hosts from NGINX which both require their own unique lua_package_path
, but have a hard time getting the configuration right.
# Failing example.conf
http {
lua_package_path = "/path/to/app/?.lua;;"
server{
listen 80;
server_name example.org
}
}
http {
lua_package_path = "/path/to/dev_app/?.lua;;"
server{
listen 80;
server_name dev.example.org
}
}
If you define the
http
twice (one for each host), you will receive this error:[emerg] "http" directive is duplicate in example.conf
If you define the
lua_package_path
inside theserver
block, you will receive this error:[emerg] "lua_package_path" directive is not allowed here in example.conf
If you define the
lua_package_path
twice in ahttp
block (which does not make any sense anyway), you will receive this error:[emerg] "lua_package_path" directive is duplicate in example.conf
What is the best practise of serving multiple (Openresty) Lua applications with their own lua_package_path
, being virtual hosts on the same IP and port?