1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-11-24 21:06:31 +00:00

Enable Leverage Browser Caching

This commit is contained in:
Lucas Ayres 2019-03-08 12:40:38 -03:00
parent 8c590fc68f
commit 3a31ef4a17

View File

@ -57,6 +57,16 @@ map $scheme $proxy_x_forwarded_ssl {
https on; https on;
} }
# Expires map
map $sent_http_content_type $expires {
default off;
~application/ 30d;
~text/ 30d;
~audio/ 365d;
~video/ 365d;
~image/ 365d;
}
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
log_format vhost '$host $remote_addr - $remote_user [$time_local] ' log_format vhost '$host $remote_addr - $remote_user [$time_local] '
@ -210,6 +220,8 @@ server {
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; access_log /var/log/nginx/access.log vhost;
expires $expires;
{{ if eq $network_tag "internal" }} {{ if eq $network_tag "internal" }}
# Only allow traffic from internal clients # Only allow traffic from internal clients
include /etc/nginx/network_internal.conf; include /etc/nginx/network_internal.conf;
@ -308,6 +320,8 @@ server {
{{ end }} {{ end }}
access_log /var/log/nginx/access.log vhost; access_log /var/log/nginx/access.log vhost;
expires $expires;
{{ if eq $network_tag "internal" }} {{ if eq $network_tag "internal" }}
# Only allow traffic from internal clients # Only allow traffic from internal clients
include /etc/nginx/network_internal.conf; include /etc/nginx/network_internal.conf;