From fc814932cf45c79c0d33f2e3909661ee96ef5989 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Wed, 23 Jan 2019 20:47:00 +0100 Subject: [PATCH] Add file caching+gzip --- conf/nginx.conf | 32 +++++++++++++++++++++----------- manifest.json | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 406079b..606e5cf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,17 +1,27 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - proxy_pass http://127.0.0.1:__PORT__; - proxy_set_header Host $host; - proxy_redirect off; - proxy_connect_timeout 600; - proxy_send_timeout 600; - proxy_read_timeout 600; - send_timeout 600; - - # allow "big" imports - client_max_body_size 8M; - + alias __FINALPATH__/build/client/; + try_files $uri $uri/index.html @kresus; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +location ~ __PATH__/\.(css|js|png|jpe?g|svg|eot|woff2?)$ { + add_header Cache-Control 'max-age=2592000, must-revalidate, public'; + gzip_types text/plain text/css application/javascript text/javascript; + gzip on; + try_files $uri $uri/index.html @kresus; +} + +location @kresus { + client_max_body_size 8M; + send_timeout 600; + proxy_connect_timeout 600; + proxy_send_timeout 600; + proxy_read_timeout 600; + proxy_set_header Host $host; + + proxy_pass http://127.0.0.1:__PORT__; + proxy_redirect off; +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 91753a8..be29baf 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "requirements": { "yunohost": ">= 2.7.14" }, - "version": "0.13.3~ynh1", + "version": "0.13.3~ynh2", "multi_instance": true, "services": [ "nginx"