aboutsummaryrefslogtreecommitdiffstats
path: root/nginx.conf
blob: c9ff152d9f093d740762e44be8bff51e7184a114 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
worker_processes  2;

pid /var/run/nginx.pid;

#                          [ debug | info | notice | warn | error | crit ]

error_log  /var/log/nginx.error_log  info;

events {
    worker_connections   2000;

}

http {

    include       mime.types;
    default_type  application/octet-stream;

    upstream app_server_djangoapp {
        server localhost:8080 fail_timeout=0;
    }

    server {
        listen 8000;
        server_name example.com;
        add_header X-Content-Type-Options nosniff;

        access_log  /var/log/nginx/guni-access.log;
        error_log  /var/log/nginx/guni-error.log info;

        keepalive_timeout 5;

        root /usr/src/app;

        location /static {
            autoindex on;
            alias /static;
        }

        #location /media {
        #   autoindex on;
        #   alias /media;
        #}

        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_connect_timeout       800;
            proxy_send_timeout          800;
            proxy_read_timeout          800;
            send_timeout                800;

            if (!-f $request_filename) {
                proxy_pass http://127.0.0.1:8080;
                break;
            }
        }
    }
}