[Nginx] Add compression, change expires

master
andryyy 2019-01-31 15:45:57 +01:00
parent 47a8c47305
commit 60f9968134
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 20 additions and 10 deletions

View File

@ -7,15 +7,6 @@ map $http_x_forwarded_proto $client_req_scheme {
https https;
}
map $sent_http_content_type $expires {
default off;
text/html off;
text/css 1d;
application/javascript 1d;
application/json off;
image/png 1d;
}
server {
include /etc/nginx/mime.types;
charset utf-8;
@ -47,6 +38,17 @@ server {
include /etc/nginx/conf.d/listen_ssl.active;
include /etc/nginx/conf.d/server_name.active;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
absolute_redirect off;
@ -105,7 +107,6 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
expires $expires;
}
location ~* ^/Autodiscover/Autodiscover.xml {
@ -185,5 +186,14 @@ server {
alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
}
location ~* \.(?:css|js|ico|woff|eot|svg|ttf|otf|png|gif|jpe?g) {
access_log off;
add_header Cache-Control public;
}
location ~* \.(?:css|js|woff|eot|svg|ttf|otf|png|gif|jpe?g) {
expires max;
}
include /etc/nginx/conf.d/site.*.custom;
}