django-fab-deploy / fab_deploy / config_templates / nginx.config

server {
    listen 80;
    server_name {{ SERVER_NAME }} www.{{ SERVER_NAME }};
    access_log /var/log/nginx/{{ INSTANCE_NAME }}.access.log;
    charset utf-8;
    client_max_body_size 8m;

    gzip_types text/plain text/xml text/css application/javascript application/x-javascript application/json;

    location / {
        proxy_pass http://localhost:{{ APACHE_PORT }};
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    # change /static to your static folder name
    location /static {
        root {{ PROJECT_DIR }};
        autoindex off;
        expires 1M;
    }

    # admin media serving
    # (this location is available if django is installed from svn)
    location /media {
        root {{ ENV_DIR }}/src/django/django/contrib/admin;
        expires 10m;
        autoindex off;
    }

    # alternative django admin media path
#    location /static/admin {
#        root {{ PROJECT_DIR }};
#        autoindex off;
#        expires 10m;
#    }

    #error_page  404  /404.html;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /var/www/nginx-default;
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.