| 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 { |
| 10 listen [::]:80 default_server; | 10 root /opt/discourse/public; |
| 11 <% else %> | |
| 12 listen 80; | |
| 13 listen [::]:80; | |
| 14 <% end %> | |
| 15 | 11 |
| 16 location / { | 12 location ~ ^/t\/[0-9]+\/[0-9]+\/avatar |
| 17 rewrite (.*) https://$host$1 permanent; | 13 { |
| 14 expires 1d; |
| 15 add_header Cache-Control public; |
| 16 add_header ETag ""; |
| 17 } |
| 18 |
| 19 location ~ ^/assets/ |
| 20 { |
| 21 expires 1y; |
| 22 add_header Cache-Control public; |
| 23 add_header ETag ""; |
| 24 break; |
| 25 } |
| 26 |
| 27 # If the file exists as a static file serve it directly without |
| 28 # running all the other rewite tests on it |
| 29 if (-f $request_filename) |
| 30 { |
| 31 break; |
| 32 } |
| 33 |
| 34 proxy_set_header X-Real-IP $remote_addr; |
| 35 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 36 proxy_set_header X-Forwarded-Proto $scheme; |
| 37 proxy_set_header Host $http_host; |
| 38 if (!-f $request_filename) |
| 39 { |
| 40 proxy_pass http://discourse; |
| 41 break; |
| 18 } | 42 } |
| 19 } | 43 } |
| 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 |