From a8dd05bb13b3c5668da9e8a680eff92d925e76f4 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 14 Sep 2010 19:04:27 +0200 Subject: [PATCH] add nginx/gunicorn config --- nginx_gunicorn/pandora.conf | 14 +++++++++++ nginx_gunicorn/vhost.in | 49 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 nginx_gunicorn/pandora.conf create mode 100644 nginx_gunicorn/vhost.in diff --git a/nginx_gunicorn/pandora.conf b/nginx_gunicorn/pandora.conf new file mode 100644 index 00000000..482d8ec4 --- /dev/null +++ b/nginx_gunicorn/pandora.conf @@ -0,0 +1,14 @@ +# pandora gunicorn daemon +# + +description "pandora daemon" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn + +chdir /srv/pandora/pandora + +exec /srv/pandora/bin/gunicorn_django -u pandora -g pandora -b 127.0.0.1:8083 -w5 settings.py + diff --git a/nginx_gunicorn/vhost.in b/nginx_gunicorn/vhost.in new file mode 100644 index 00000000..96db6256 --- /dev/null +++ b/nginx_gunicorn/vhost.in @@ -0,0 +1,49 @@ +server { + listen 80 default; + #server_name pandora.example.com; + + access_log /var/log/nginx/pandora.access.log; + error_log /var/log/nginx/pandora.error.log; + + location /admin/media { + root __PREFIX__/src/django/django/contrib; + autoindex on; + } + location /favicon.ico { + root __PREFIX__/pandora/static; + } + + location /static { + root __PREFIX__/pandora; + autoindex on; + } + location /media/ { + internal; + root __PREFIX__/pandora/; + } + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + + if (!-f $request_filename) { + proxy_pass http://127.0.0.1:8083; + break; + } + } + location /api/upload { + client_max_body_size 32m; + } + + error_page 404 /404.html; + location /404.html { + root __PREFIX__/pandora/static; + } + + # redirect server error pages to the static page /50x.html + error_page 500 502 503 504 /50x.html; + location /50x.html { + root __PREFIX__/pandora/static; + } +}