运行 一个带有 nginx 的守护进程 bottle 应用程序

Running a daemonized bottle application with nginx

我有一个 bottle 应用程序(具体来说,homu),我想将其部署在服务器上。

运行 此应用程序的传统方法是 运行 程序(例如 python whatever.py),没有任何服务器集成。该应用程序是有状态的,并通过侦听 github webhooks api 来更新其状态。它还有一个瓶子送的配置面板。

虽然它能够从崩溃中恢复,但这需要大量 GitHub API 请求(会受到限制),因此最好让它连续 运行ning .

现在,我知道 how to daemonize a bottle application,但这需要 运行将其作为一个单独的程序 运行在与 nginx 不同的端口上使用。我想让 nginx 将某些路径委托给 运行ning bottle 应用程序。

我该怎么做?

(或者,我可以设置它,让 nginx 负责保存它 运行ning 也不错)

实现此目的的一种方法是对其进行反向代理。

location /foo/bar {
  proxy_pass http://localhost:someport/;
}

然后 运行 someport

上的瓶子应用