简体   繁体   English

如何阻止rails nginx-passenger应用程序?

[英]How to stop rails nginx-passenger application?

I use the passenger spawned by nginx . 我使用nginx产生的passenger There are many other rails applications on the server that uses passenger (each has own virtual host in nginx). 服务器上还有许多使用乘客的其他rails应用程序(每个应用程序在nginx中都有自己的虚拟主机)。

I can restart the Rails/Nginx/Passenger application like this: 我可以像这样重启Rails / Nginx / Passenger应用程序:

touch tmp/restart.txt

How I can stop it? 我怎么能阻止它?

This doesn't work: 这不起作用:

touch tmp/stop.txt
touch tmp/shutdown.txt

Method 1 方法1

Remove your app's virtual host entry and restart Nginx. 删除应用程序的虚拟主机条目并重新启动Nginx。 Phusion Passenger will no longer serve it. Phusion Passenger将不再提供服务。

Method 2 方法2

In case you want to keep your app's virtual host entry, but not actually run the app. 如果您想保留应用程序的虚拟主机条目,但实际上并未运行该应用程序。

Set the following option and restart Nginx: 设置以下选项并重新启动Nginx:

passenger_min_instances 0;

Phusion Passenger will now shut down your app if it hasn't seen traffic for a while (~10 minutes). 如果Phusion Passenger没有看到流量一段时间(约10分钟),Phusion Passenger现在会关闭你的应用程序。 It'll be started again if traffic comes in for that app. 如果流量进入该应用程序,它将再次启动。

With passenger_min_instances 0 , you can also kill the application processes manually. 使用passenger_min_instances 0 ,您还可以手动终止应用程序进程。 Look up the PIDs with passenger-status , then run kill <PID> . 使用passenger-status查找PID,然后运行kill <PID>

Passenger is built to auto-run at all times. 乘客可以随时自动运行。

As a workaround, you can stop the webserver entirely, or stop serving the particular app that you don't want to be served by removing the virtual host entry for it. 作为一种变通方法,您可以完全停止Web服务器,或者通过删除虚拟主机条目来停止为您不希望提供服务的特定应用程序提供服务。

You could also uninstall passenger if you're really desperate 如果你真的很绝望,你也可以卸载乘客

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM