diff --git a/doc/buildweb.py b/doc/buildweb.py index 7d590553..bed19e51 100755 --- a/doc/buildweb.py +++ b/doc/buildweb.py @@ -108,7 +108,7 @@ class Page(object): if not tmpl_name: return self.body - kwargs = {"conf": conf, "stuff": self.body, "url": self.url()} + kwargs = {"conf": conf, "body": self.body, "url": self.url()} kwargs.update(self.headers) return self.site.get_template(tmpl_name).render(kwargs) diff --git a/doc/htdocs/configuration.html b/doc/htdocs/configuration.html index dab7da07..716626cf 100644 --- a/doc/htdocs/configuration.html +++ b/doc/htdocs/configuration.html @@ -2,7 +2,7 @@ - Green Unicorn - Configuration + Green Unicorn - The Configuration File + + + + +
+ + + + + +
+

Production Setup

+

Although there are many HTTP proxies available, we strongly advise that you use Nginx. If you choose another proxy server you need to make sure that it buffers slow clients. Without this buffering Gunicorn will be easily susceptible to Denial-Of-Service attacks.

+
+

Nginx Config

+

An example configuration file for use with Nginx:

+
+worker_processes 1;
+
+user nobody nogroup;
+pid /tmp/nginx.pid;
+error_log /tmp/nginx.error.log;
+
+events {
+    worker_connections 1024;
+    accept_mutex off;
+}
+
+http {
+    include mime.types;
+    default_type application/octet-stream;
+    access_log /tmp/nginx.access.log combined;
+    sendfile on;
+
+    upstream app_server {
+        server unix:/tmp/gunicorn.sock fail_timeout=0;
+        # For a TCP configuration:
+        # server 192.168.0.7:8000 fail_timeout=0;
+    }
+
+    server {
+        listen 80 default;
+        client_max_body_size 4G;
+        server_name _;
+
+        keepalive_timeout 5;
+
+        # path for static files
+        root /path/to/app/current/public;
+
+        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://app_server;
+                break;
+            }
+        }
+
+        error_page 500 502 503 504 /500.html;
+        location = /500.html {
+            root /path/to/app/current/public;
+        }
+    }
+}
+
+
+
+

Daemon Monitoring

+

A popular method for deploying Gunicorn is to have it monitored by runit. An example service definition:

+
+#!/bin sh
+
+GUNICORN=/usr/local/bin/gunicorn
+ROOT=/path/to/project
+PID=/var/run/gunicorn.pid
+
+APP=main:application
+
+if [ -f $PID ]; then rm $PID fi
+
+cd $ROOT
+exec $GUNICORN -C $ROOT/gunicorn.conf.py --pidfile=$PID $APP
+
+
+
+ + + + + + +
+ + \ No newline at end of file diff --git a/doc/htdocs/faq.html b/doc/htdocs/faq.html index de087dbf..ce9863f4 100644 --- a/doc/htdocs/faq.html +++ b/doc/htdocs/faq.html @@ -38,6 +38,7 @@