【发布时间】:2017-01-30 17:17:40
【问题描述】:
我正在尝试将两个 (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如果您在
server块内定义lua_package_path,您将收到此错误:[emerg] "lua_package_path" directive is not allowed here in example.conf如果您在
http块中定义了两次lua_package_path(无论如何这没有任何意义),您将收到此错误:[emerg] "lua_package_path" directive is duplicate in example.conf
使用自己的lua_package_path 为多个 (Openresty) Lua 应用程序提供服务的最佳实践是什么,它们是同一 IP 和端口上的虚拟主机?
【问题讨论】:
标签: nginx configuration lua virtualhost openresty