This repository has been archived by the owner on May 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
PSGINginx
Wes edited this page May 20, 2014
·
1 revision
Nginx acts as a proxy to a native running PSGI application. It requires that either plackup, starman or some other PSGI handler is running behind the scenes.
- start plackup
$ sudo plackup /opt/cif/bin/cif.psgi --path /api
HTTP::Server::PSGI: Accepting connections at http://0:5000/
- start starman
- configure
/etc/nginx/sites-enabled/cif.conf
server {
server_name myapp.example.com;
listen 80;
location /api {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:5000;
}
}
- restart nginx
- ping the interface
$ curl -w "\n" -X GET 'http://localhost/api/_ping?token=1234'
{"timestamp":[1400585768,265584]}