|
1 |
| -worker_processes 1; |
2 |
| - |
3 |
| -events { |
4 |
| - worker_connections 1024; # increase if you have lots of clients |
5 |
| - accept_mutex off; # set to 'on' if nginx worker_processes > 1 |
6 |
| - # 'use epoll;' to enable for Linux 2.6+ |
7 |
| - # 'use kqueue;' to enable for FreeBSD, OSX |
| 1 | +upstream django { |
| 2 | + server django:8000; |
8 | 3 | }
|
9 | 4 |
|
10 |
| -http { |
11 |
| - include mime.types; |
12 |
| - # fallback in case we can't determine a type |
13 |
| - default_type application/octet-stream; |
14 |
| - access_log /var/log/nginx/access.log combined; |
15 |
| - sendfile on; |
16 |
| - |
17 |
| - upstream app_server { |
18 |
| - # fail_timeout=0 means we always retry an upstream even if it failed |
19 |
| - # to return a good HTTP response |
20 |
| - |
21 |
| - # for UNIX domain socket setups |
22 |
| - # server unix:/tmp/gunicorn.sock fail_timeout=0; |
23 |
| - |
24 |
| - # for a TCP configuration |
25 |
| - server django:8000 fail_timeout=0; |
26 |
| - } |
| 5 | +server { |
27 | 6 |
|
28 |
| - server { |
29 |
| - # if no Host match, close the connection to prevent host spoofing |
30 |
| - listen 80 default_server; |
31 |
| - return 444; |
32 |
| - } |
33 |
| - |
34 |
| - server { |
35 |
| - # use 'listen 80 deferred;' for Linux |
36 |
| - # use 'listen 80 accept_filter=httpready;' for FreeBSD |
37 | 7 | listen 80;
|
38 |
| - client_max_body_size 4G; |
39 |
| - |
40 |
| - # set the correct host(s) for your site |
41 |
| - server_name 34.82.120.199; |
42 |
| - |
43 |
| - keepalive_timeout 5; |
44 | 8 |
|
45 | 9 | location / {
|
46 |
| - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
47 |
| - proxy_set_header X-Forwarded-Proto $scheme; |
48 |
| - proxy_set_header Host $http_host; |
49 |
| - # we don't want nginx trying to do something clever with |
50 |
| - # redirects, we set the Host: header above already. |
51 |
| - proxy_redirect off; |
52 |
| - proxy_pass http://app_server; |
| 10 | + proxy_pass http://django; |
| 11 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 12 | + proxy_set_header Host $host; |
| 13 | + proxy_redirect off; |
53 | 14 | }
|
54 |
| - } |
55 | 15 | }
|
| 16 | + |
0 commit comments