Skip to content

Commit

Permalink
Browser caching and compression (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
amplifi authored Mar 2, 2017
1 parent 7acb2fb commit 83bf226
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions provision/roles/webserver/production/templates/nginx-production
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ upstream django {
server unix:{{ uwsgi_socket }};
}

map $sent_http_content_type $expires {
default 24h;
text/html epoch;
text/css 24h;
application/javascript 24h;
~image/ 24h;
}

server {
listen 80; #force redirect to https for API URLs
server_name {{ api_url }};
Expand Down Expand Up @@ -74,8 +82,21 @@ server {
ssl_certificate /etc/ssl/private/domain.crt;
ssl_certificate_key /etc/ssl/private/domain.key;

expires $expires;
etag on;
add_header Cache-Control "private, must-revalidate";

charset utf-8;

gzip on;
gzip_http_version 1.0;
gzip_disable "msie6";
gzip_min_length 500;
gzip_buffers 16 8k;
gzip_proxied expired no-cache no-store private;
gzip_types *;
gzip_vary on;

client_max_body_size 75M;

# alias favicon.* to static
Expand Down

0 comments on commit 83bf226

Please sign in to comment.