-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf_PageSpeed-ified
107 lines (76 loc) · 2.93 KB
/
nginx.conf_PageSpeed-ified
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
upstream balder {
server balder; #192.168.1.254:3000;
}
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
# adds gzip options
gzip on;
gzip_types text/css text/plain text/xml text/html application/xml application/javascript application/x-javascript text/javascript application/json text/x-json;
gzip_proxied no-store no-cache private expired auth;
gzip_disable "MSIE [1-6]\.";
server {
listen 80;
server_name localhost;
#PageSpeed activate!
pagespeed on;
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed MaxSegmentLength 250;
# enable CoreFilters
#pagespeed RewriteLevel CoreFilters;
# disable CoreFilters
pagespeed RewriteLevel PassThrough;
# disable individual
#pagespeed DisableFilters rewrite_images;
# force caching
pagespeed ForceCaching on;
# enable specific filters
pagespeed EnableFilters remove_comments,collapse_whitespace,canonicalize_javascript_libraries,combine_css,rewrite_css,combine_javascript,elide_attributes,extend_cache,flatten_css_imports,lazyload_images,rewrite_javascript,rewrite_images,insert_dns_prefetch,prioritize_critical_css,fallback_rewrite_css_urls,extend_cache;
pagespeed CssFlattenMaxBytes 5120;
pagespeed UseExperimentalJsMinifier on;
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.[a-z]{2}\.[^.]{10}\.[^.]+" { }
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }
#charset koi8-r;
access_log /var/log/nginx/balderProxy.log;
location / {
proxy_pass http://balder;
proxy_http_version 1.1;
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location ~* /partials/[a-zA-Z0-9]\.(html)$ {
add_header Cache-Control "public, max-age=86400";
}
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}