如何在 Phusion Passenger 中检测 nginx.conf.erb 内的 app_type?

How to detect app_type within nginx.conf.erb in Phusion Passenger?

是否有一种(推荐的)方法可以在 nginx.conf.erb 内确定 Phusion Passenger(在独立模式下)根据其 autodetection algorithm? In Passenger 5.1.8, we'd been relying on AppFinder.looks_like_app_directory?, but it looks like that's been made private in 5.1.11 自动检测到的 app_type

我们可以简单地自己寻找 ["config.ru", "passenger_wsgi.py", "app.js", ".meteor"] 中的任何一个,但更愿意依赖已经检测到的 app_type,特别是如果它是在命令行中使用 --app-type 手动指定的。

假设您在服务器块中,那么 <%= nginx_option(app, :app_type) %> 应该适合您。

如果您只需要它作为条件性的东西,而不是输出,那么 app[:app_type] 就是您想要的。