On Wed, Apr 14, 2010 at 18:03, Duncan Hutty <dhutty@allgoodbits.org> wrote:
I'm looking to have nginx use Dancer to run a subsection of a website,
but while I know how to use apache fairly well, I'm new to both nginx
and Dancer.

We use nginx extensively and I would definitely recommend this scheme.

I prefer HTTP-only setup for various reasons (mostly because it's much easier to debug than FastCGI) so
here's my very simple Starman-based configuration that runs http://perl.worldken.org.

I run a Dancer app with this:

$ plackup -s Starman -p 6001 -E production

And the nginx config:
server {
        listen   80;
        server_name  perl.worldken.org;
        access_log  /var/log/nginx/perl.worldken.org.access.log;
        location / {
                proxy_pass   http://127.0.0.1:6001;
        }
}

Ask any questions.


I've looked carefully at D::Deployment and nginx/PSGI/Plack docs and I
confess to be a little confused as to where each part fits into the whole.

I think I understand how to make nginx proxy for requests for the
subsection using fastcgi:

server {
       listen *:80;
       servername blah
       location        / {
               root    /var/www/html;
               index   index.html
       }

       location /dancer {
               include fastcgi_params;
               fastcgi_pass    unix:/var/run/dancer.sock;
       }
}

But that means that, unlike Apache, I need something else to create the
socket, listen for requests, respond to the requests, etc.

I think that could be a standalone plackup daemon:
plackup -s FCGI --listen /var/run/dancer.sock --daemonize --nproc 5
--app /path/to/Dancer_App/app.psgi

that would I then write my own initscript for.

Is that:
a) correct?
b) considered to be an admirable, efficient way to run a small
production server or is this more for a development environment?

I think that instead of the plackup command, I could use Starman to do the same thing.

I think my confusion is coming from the fact that there are so many
possible ways to deploy and I don't have a good understanding of how
fastcgi/psgi/plack all fit together.

Perhaps I need some explication rather than merely instructions, although instructions would be a good start:)

Duncan Hutty

_______________________________________________
Dancer-users mailing list
Dancer-users@perldancer.org
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users