OLD | NEW |
1 upstream discourse { | 1 gzip on; |
2 server localhost:3000; | 2 gzip_min_length 1000; |
3 } | 3 gzip_types application/json text/css application/x-javascript; |
4 | 4 |
5 server { | 5 sendfile on; |
6 server_name <%= @domain %>; | 6 keepalive_timeout 65; |
7 | 7 |
8 <% if is_default %> | 8 location / { |
9 listen 80 default_server; | 9 root /opt/discourse/public; |
10 listen [::]:80 default_server; | |
11 <% else %> | |
12 listen 80; | |
13 listen [::]:80; | |
14 <% end %> | |
15 | 10 |
16 location / { | 11 location ~ ^/t\/[0-9]+\/[0-9]+\/avatar { |
17 rewrite (.*) https://$host$1 permanent; | 12 expires 1d; |
| 13 add_header Cache-Control public; |
| 14 add_header ETag ""; |
| 15 } |
| 16 |
| 17 location ~ ^/assets/ { |
| 18 expires 1y; |
| 19 add_header Cache-Control public; |
| 20 add_header ETag ""; |
| 21 break; |
| 22 } |
| 23 |
| 24 # If the file exists as a static file serve it directly without |
| 25 # running all the other rewite tests on it |
| 26 if (-f $request_filename) { |
| 27 break; |
| 28 } |
| 29 |
| 30 proxy_set_header X-Real-IP $remote_addr; |
| 31 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 32 proxy_set_header X-Forwarded-Proto $scheme; |
| 33 proxy_set_header Host $http_host; |
| 34 if (!-f $request_filename) { |
| 35 proxy_pass http://discourse; |
| 36 break; |
18 } | 37 } |
19 } | 38 } |
20 server { | |
21 server_name <%= @domain %>; | |
22 | |
23 <% if is_default %> | |
24 listen 443 ssl default_server; | |
25 listen [::]:443 ssl default_server; | |
26 <% else %> | |
27 listen 443 ssl; | |
28 listen [::]:443 ssl; | |
29 <% end %> | |
30 | |
31 ssl_certificate sites-available/adblockplus.org_sslcert.pem; | |
32 ssl_certificate_key sites-available/adblockplus.org_sslcert.key; | |
33 | |
34 gzip on; | |
35 gzip_min_length 1000; | |
36 gzip_types application/json text/css application/x-javascript; | |
37 | |
38 sendfile on; | |
39 keepalive_timeout 65; | |
40 | |
41 location / { | |
42 root /opt/discourse/public; | |
43 | |
44 location ~ ^/t\/[0-9]+\/[0-9]+\/avatar { | |
45 expires 1d; | |
46 add_header Cache-Control public; | |
47 add_header ETag ""; | |
48 } | |
49 | |
50 location ~ ^/assets/ { | |
51 expires 1y; | |
52 add_header Cache-Control public; | |
53 add_header ETag ""; | |
54 break; | |
55 } | |
56 | |
57 # If the file exists as a static file serve it directly without | |
58 # running all the other rewite tests on it | |
59 if (-f $request_filename) { | |
60 break; | |
61 } | |
62 | |
63 proxy_set_header X-Real-IP $remote_addr; | |
64 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
65 proxy_set_header X-Forwarded-Proto $scheme; | |
66 proxy_set_header Host $http_host; | |
67 if (!-f $request_filename) { | |
68 proxy_pass http://discourse; | |
69 break; | |
70 } | |
71 } | |
72 } | |
OLD | NEW |