我目前正在尝试确定在独立模式下运行乘客时如何适当地设置passenger_base_uri。我尝试覆盖nginx.conf.erb以包括passenger_base_uri,也尝试按照设置在 https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#deploying-an-app-to-a-sub-uri 这两种方法都产生了随机服务404的奇怪结果。
对于是否有一种直接的方法可以为单个应用程序进行配置感到好奇(看起来好像有某个环境变量选项可以在某个时候允许这样做)。
我不是试图在单个乘客服务器上部署多个应用程序,只是试图更改单个应用程序的上下文而不必更改路线。
来自乘客状态的版本: nginx / 1.12.2 Phusion_Passenger / 5.2.3
更新: 我尝试使用最新版本的passenger(6.0.1),但仍然看到随机的404。我还尝试提高了乘客的日志记录级别,似乎出现了一个问题,其中一些乘客进程在传递请求之前未正确设置“ SCRIPT_NAME”。我似乎无法在本地重现此错误,但可以在已部署的实例中可靠地重现此错误。
可同时为404和200服务的pid:
# passenger-status && curl -I -k https://127.0.0.1/test/meta/availability
Version : 6.0.1
Date : 2019-01-23 00:31:59 +0000
Instance: 36X3YTqe (nginx/1.15.8 Phusion_Passenger/6.0.1)
----------- General information -----------
Max pool size : 10
App groups : 1
Processes : 10
Requests in top-level queue : 0
----------- Application groups -----------
/opt/app (production):
App root: /opt/app
Requests in queue: 0
* PID: 129 Sessions: 0 Processed: 59 Uptime: 12m 55s
CPU: 0% Memory : 68M Last used: 1s ago
* PID: 152 Sessions: 0 Processed: 1 Uptime: 12m 54s
CPU: 0% Memory : 45M Last used: 12m 54s ago
* PID: 176 Sessions: 0 Processed: 0 Uptime: 12m 54s
CPU: 0% Memory : 41M Last used: 12m 54s ago
* PID: 202 Sessions: 0 Processed: 0 Uptime: 12m 53s
CPU: 0% Memory : 41M Last used: 12m 53s ago
....
HTTP/1.1 200 OK
Date: Wed, 23 Jan 2019 00:32:00 GMT
X-Powered-By: Phusion Passenger 6.0.1
Server: nginx/1.15.8 + Phusion Passenger 6.0.1
# passenger-status && curl -I -k https://127.0.0.1/test/meta/availability
Version : 6.0.1
Date : 2019-01-23 00:32:01 +0000
Instance: 36X3YTqe (nginx/1.15.8 Phusion_Passenger/6.0.1)
----------- General information -----------
Max pool size : 10
App groups : 1
Processes : 10
Requests in top-level queue : 0
----------- Application groups -----------
/opt/app (production):
App root: /opt/app
Requests in queue: 0
* PID: 129 Sessions: 0 Processed: 60 Uptime: 12m 57s
CPU: 0% Memory : 68M Last used: 1s ago
* PID: 152 Sessions: 0 Processed: 1 Uptime: 12m 56s
CPU: 0% Memory : 45M Last used: 12m 56s ago
* PID: 176 Sessions: 0 Processed: 0 Uptime: 12m 56s
CPU: 0% Memory : 41M Last used: 12m 56s ago
* PID: 202 Sessions: 0 Processed: 0 Uptime: 12m 55s
CPU: 0% Memory : 41M Last used: 12m 55s ago
....
HTTP/1.1 404 Not Found
Date: Wed, 23 Jan 2019 00:32:01 GMT
X-Powered-By: Phusion Passenger 6.0.1
Server: nginx/1.15.8 + Phusion Passenger 6.0.1
答案 0 :(得分:0)
对类似的github issue提出了一些反馈。似乎是较新版本的乘客(大于5.1,当前最高可用为6.0.1)存在问题。应该可以只设置passenger_base_uri,但该错误会导致随机产生404。