Skip to content

Instantly share code, notes, and snippets.

@tene
Created May 15, 2011 06:39
Show Gist options
  • Save tene/972924 to your computer and use it in GitHub Desktop.
Save tene/972924 to your computer and use it in GitHub Desktop.
basic psgi worker running on nginx
#!/usr/bin/perl
use warnings;
use strict;
use v5.010;
use Dancer;
get '/' => sub {
return <<'ROOT';
<p>root</p>
<p><a href="/bye">Bye</a></p>
ROOT
};
get '/bye' => sub {
return <<'BYE';
<p>Bye!</p>
<p><a href="/">Root</a></p>
BYE
};
sub {
my $env = shift;
my $request = Dancer::Request->new( $env );
Dancer->dance( $request );
}
apphandler: 'PSGI'
log: 'core'
logger: 'file'
log_path: 'logs'
server {
listen 1234;
server_name localhost sweeks-laptop;
location / {
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/tmp/fcgi.sock;
}
}
#!/bin/bash
plackup -s FCGI --listen /tmp/fcgi.sock --nproc 10 -a app.psgi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment