rails应用修改了Nginx部署的文件后如何刷新?

How to refresh rails application after modify some file which deployed by Nginx?

使用 Nginx 和 Unicorn 部署了 rails 应用程序。想更改配置文件。是否需要重启Nginx?或者只是 touch public/robots.txt?

如果有效,为什么 touch public/robots.txt 但不触发其他文件?

我认为 touch tmp/restart.txt 方法是特定于乘客的。对于unicorn,你可以从更新代码的目录发送一个USR2信号给它杀死它,然后重启Unicorn实例。

根据 OS 你 运行 它的不同,发送信号可能会有所不同(sigkill 等)。还假设您使用 Capistrano 进行部署:

# Kill unicorn
run "kill -s USR2 `cat #{unicorn_pid_file_location}`"

# then restart unicorn with updated config
run "#{unicorn_rails_or_unicorn} -c #{your_current_folder}/config/unicorn.rb -D -E production"