我正在尝试将两个(Openresty)Lua Web 应用程序作为来自 NGINX 的虚拟主机提供服务,它们都需要自己独特的lua_package_path,但很难正确配置。
# 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
}
}
如果您定义
http两次(每个主机一次),您将收到此错误:[emerg] "http" directive is duplicate in example.conf如果你定义块
lua_package_path内部server,你会收到这个错误:[emerg] "lua_package_path" directive is not allowed here in example.conf如果您
lua_package_path在一个块中定义两次http(无论如何这没有任何意义),您将收到此错误:[emerg] "lua_package_path" directive is duplicate in example.conf
为多个(Openresty)Lua 应用程序提供服务的最佳实践是什么,它们lua_package_path是同一 IP 和端口上的虚拟主机?