为什么将Nginx与Catalyst/Plack/Starman一起使用? [英] Why use nginx with Catalyst/Plack/Starman?
问题描述
我正在尝试使用Plack/Starman部署我的小型Catalyst Web应用程序.所有文档似乎都建议我将其与nginx结合使用.这有什么好处?为什么不直接在80端口上使用Starman?
I am trying to deploy my little Catalyst web app using Plack/Starman. All the documentation seems to suggest I want to use this in combination with nginx. What are the benefits of this? Why not use Starman straight up on port 80?
推荐答案
不必特别是nginx,但是出于某些原因,您希望某种前端服务器代理到您的应用程序服务器:
It doesn't have to be nginx in particular, but you want some kind of frontend server proxying to your application server for a few reasons:
-
这样,您可以以普通用户的身份在高端口上运行Catalyst服务器,而在端口80上运行前端服务器.
So that you can run the Catalyst server on a high port, as an ordinary user, while running the frontend server on port 80.
无需占用perl进程即可提供静态文件(图像,JS和CSS等常规资源,以及您可能希望使用X-Sendfile或X-Accel-Redirect进行的任何类型的下载)在下载期间.
To serve static files (ordinary resources like images, JS, and CSS, as well as any sort of downloads you might want to use X-Sendfile or X-Accel-Redirect with) without tying up a perl process for the duration of the download.
如果您要进行涉及例如以下内容的更复杂的配置,它将使事情变得更容易. Edge Side Includes,或让Web服务器直接从memcached或mogilefs(nginx可以做的事情)或负载平衡/HA配置中提供服务.
It makes things easier if you want to move on to a more complicated config involving e.g. Edge Side Includes, or having the webserver serve directly from memcached or mogilefs (both things that nginx can do), or a load-balancing / HA config.
这篇关于为什么将Nginx与Catalyst/Plack/Starman一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!