perlnginxcatalystplackstarman

Why use nginx with Catalyst/Plack/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?


Solution

  • 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:

    1. So that you can run the Catalyst server on a high port, as an ordinary user, while running the frontend server on port 80.

    2. 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.

    3. 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.