Search code examples
perlnginxdancer

How to run multiple perl Dancer2 apps in same nginx server


I figured that I can manage multiple apps using location in nginx.

But it seems like I cannot run multiple dancer2 apps in same server with different ports (like localhost:3000, localhost:4000).

Anyway I'm putting this here with a hope that experts can show me some light.


Solution

  • But it seems like I cannot run multiple dancer2 apps in same server with different ports (like localhost:3000, localhost:4000).

    This isn't true. Dancer (and, obviously, Dancer2) apps know nothing about the port that they are listening to. That is all handled by your deployment environment. If, for example, you have two Dancer apps called app1.psgi and app2.psgi and you are starting them with plackup, then you can get them running on different ports using the -p command line option.

    $ plackup -p 3000 app1.psgi
    $ plackup -p 4000 app2.psgi