|
1 |
| -upstream hello_app_server { |
2 |
| - server unix:/var/www/DjangoBlog/run/gunicorn.sock fail_timeout=0; |
3 |
| -} |
4 |
| - |
5 | 1 | server {
|
6 |
| - |
7 |
| - |
8 | 2 | server_name blog.lylinux.org;
|
9 | 3 | root /var/www/DjangoBlog/;
|
10 |
| - |
11 | 4 | listen 80;
|
12 |
| - |
13 | 5 | keepalive_timeout 70;
|
14 |
| - access_log off; |
15 | 6 |
|
16 | 7 | location /static/ {
|
17 | 8 | expires max;
|
18 | 9 | alias /var/www/DjangoBlog/collectedstatic/;
|
19 | 10 | }
|
20 | 11 |
|
21 | 12 | location / {
|
22 |
| -# an HTTP header important enough to have its own Wikipedia entry: |
23 |
| -# http://en.wikipedia.org/wiki/X-Forwarded-For |
| 13 | + proxy_set_header X-Real-IP $remote_addr; |
24 | 14 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
25 |
| - |
26 |
| -# enable this if and only if you use HTTPS, this helps Rack |
27 |
| -# set the proper protocol for doing redirects: |
28 |
| -# proxy_set_header X-Forwarded-Proto https; |
29 |
| - |
30 |
| -# pass the Host: header from the client right along so redirects |
31 |
| -# can be set properly within the Rack application |
32 | 15 | proxy_set_header Host $http_host;
|
33 |
| - |
34 |
| -# we don't want nginx trying to do something clever with |
35 |
| -# redirects, we set the Host: header above already. |
| 16 | + proxy_set_header X-NginX-Proxy true; |
36 | 17 | proxy_redirect off;
|
37 |
| - |
38 |
| -# set "proxy_buffering off" *only* for Rainbows! when doing |
39 |
| -# Comet/long-poll stuff. It's also safe to set if you're |
40 |
| -# using only serving fast clients with Unicorn + nginx. |
41 |
| -# Otherwise you _want_ nginx to buffer responses to slow |
42 |
| -# clients, really. |
43 |
| -# proxy_buffering off; |
44 |
| - |
45 |
| -# Try to serve static files from nginx, no point in making an |
46 |
| -# *application* server like Unicorn/Rainbows! serve static files. |
47 | 18 | if (!-f $request_filename) {
|
48 |
| - proxy_pass http://hello_app_server; |
49 |
| - break; |
| 19 | + proxy_pass http://127.0.0.1:8000; |
| 20 | + break; |
50 | 21 | }
|
51 | 22 | }
|
52 | 23 |
|
|
0 commit comments