Skip to content

Commit 8e46886

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-31196' into UI
2 parents e2597e1 + 574d158 commit 8e46886

File tree

3 files changed

+236
-2
lines changed

3 files changed

+236
-2
lines changed

nginx.conf.sample

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# include /vagrant/magento2/nginx.conf.sample;
1818
# }
1919

20+
2021
root $MAGE_ROOT;
2122

2223

@@ -46,17 +47,56 @@ location / {
4647
rewrite / /index.php ;
4748
}
4849

49-
5050
location /static/ {
51+
5152
if ($MAGE_MODE = "production") {
5253
expires max;
5354
}
55+
56+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
57+
add_header Cache-Control "public";
58+
expires +1y;
59+
60+
if (!-f $request_filename) {
61+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
62+
}
63+
}
64+
65+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
66+
add_header Cache-Control "no-store";
67+
expires off;
68+
69+
if (!-f $request_filename) {
70+
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
71+
}
72+
73+
}
74+
5475
if (!-f $request_filename) {
5576
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
5677
}
5778
}
5879

5980
location /media/ {
81+
82+
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
83+
add_header Cache-Control "public";
84+
expires +1y;
85+
86+
if (!-f $request_filename) {
87+
rewrite / /get.php;
88+
}
89+
}
90+
91+
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
92+
add_header Cache-Control "no-store";
93+
expires off;
94+
95+
if (!-f $request_filename) {
96+
rewrite / /get.php;
97+
}
98+
}
99+
60100
if (!-f $request_filename) {
61101
rewrite / /get.php;
62102
}
@@ -99,4 +139,4 @@ location / {
99139
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
100140
include fastcgi_params;
101141
}
102-
}
142+
}

pub/media/.htaccess

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,100 @@ Options -ExecCGI
2323

2424
RewriteRule .* ../get.php [L]
2525
</IfModule>
26+
27+
############################################
28+
## setting MIME types
29+
30+
# JavaScript
31+
AddType application/javascript js jsonp
32+
AddType application/json json
33+
34+
# CSS
35+
AddType text/css css
36+
37+
# Images and icons
38+
AddType image/x-icon ico
39+
AddType image/gif gif
40+
AddType image/png png
41+
AddType image/jpeg jpg
42+
AddType image/jpeg jpeg
43+
44+
# SVG
45+
AddType image/svg+xml svg
46+
47+
# Fonts
48+
AddType application/vnd.ms-fontobject eot
49+
AddType application/x-font-ttf ttf
50+
AddType application/x-font-otf otf
51+
AddType application/x-font-woff woff
52+
AddType application/font-woff2 woff2
53+
54+
# Flash
55+
AddType application/x-shockwave-flash swf
56+
57+
# Archives and exports
58+
AddType application/zip gzip
59+
AddType application/x-gzip gz gzip
60+
AddType application/x-bzip2 bz2
61+
AddType text/csv csv
62+
AddType application/xml xml
63+
64+
<IfModule mod_headers.c>
65+
66+
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$>
67+
Header append Cache-Control public
68+
</FilesMatch>
69+
70+
<FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>
71+
Header append Cache-Control no-store
72+
</FilesMatch>
73+
74+
</IfModule>
75+
76+
<IfModule mod_expires.c>
77+
78+
############################################
79+
## Add default Expires header
80+
## http://developer.yahoo.com/performance/rules.html#expires
81+
82+
ExpiresActive On
83+
84+
# Data
85+
<FilesMatch \.(zip|gz|gzip|bz2|csv|xml)$>
86+
ExpiresDefault "access plus 0 seconds"
87+
</FilesMatch>
88+
ExpiresByType text/xml "access plus 0 seconds"
89+
ExpiresByType text/csv "access plus 0 seconds"
90+
ExpiresByType application/json "access plus 0 seconds"
91+
ExpiresByType application/zip "access plus 0 seconds"
92+
ExpiresByType application/x-gzip "access plus 0 seconds"
93+
ExpiresByType application/x-bzip2 "access plus 0 seconds"
94+
95+
# CSS, JavaScript
96+
<FilesMatch \.(css|js)$>
97+
ExpiresDefault "access plus 1 year"
98+
</FilesMatch>
99+
ExpiresByType text/css "access plus 1 year"
100+
ExpiresByType application/javascript "access plus 1 year"
101+
102+
# Favicon, images, flash
103+
<FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$>
104+
ExpiresDefault "access plus 1 year"
105+
</FilesMatch>
106+
ExpiresByType image/gif "access plus 1 year"
107+
ExpiresByType image/png "access plus 1 year"
108+
ExpiresByType image/jpg "access plus 1 year"
109+
ExpiresByType image/jpeg "access plus 1 year"
110+
ExpiresByType image/svg+xml "access plus 1 year"
111+
112+
# Fonts
113+
<FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>
114+
ExpiresDefault "access plus 1 year"
115+
</FilesMatch>
116+
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
117+
ExpiresByType application/x-font-ttf "access plus 1 year"
118+
ExpiresByType application/x-font-otf "access plus 1 year"
119+
ExpiresByType application/x-font-woff "access plus 1 year"
120+
ExpiresByType application/font-woff2 "access plus 1 year"
121+
122+
</IfModule>

pub/static/.htaccess

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,100 @@ php_flag engine 0
1212

1313
RewriteRule .* ../static.php?resource=$0 [L]
1414
</IfModule>
15+
16+
############################################
17+
## setting MIME types
18+
19+
# JavaScript
20+
AddType application/javascript js jsonp
21+
AddType application/json json
22+
23+
# CSS
24+
AddType text/css css
25+
26+
# Images and icons
27+
AddType image/x-icon ico
28+
AddType image/gif gif
29+
AddType image/png png
30+
AddType image/jpeg jpg
31+
AddType image/jpeg jpeg
32+
33+
# SVG
34+
AddType image/svg+xml svg
35+
36+
# Fonts
37+
AddType application/vnd.ms-fontobject eot
38+
AddType application/x-font-ttf ttf
39+
AddType application/x-font-otf otf
40+
AddType application/x-font-woff woff
41+
AddType application/font-woff2 woff2
42+
43+
# Flash
44+
AddType application/x-shockwave-flash swf
45+
46+
# Archives and exports
47+
AddType application/zip gzip
48+
AddType application/x-gzip gz gzip
49+
AddType application/x-bzip2 bz2
50+
AddType text/csv csv
51+
AddType application/xml xml
52+
53+
<IfModule mod_headers.c>
54+
55+
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$>
56+
Header append Cache-Control public
57+
</FilesMatch>
58+
59+
<FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>
60+
Header append Cache-Control no-store
61+
</FilesMatch>
62+
63+
</IfModule>
64+
65+
<IfModule mod_expires.c>
66+
67+
############################################
68+
## Add default Expires header
69+
## http://developer.yahoo.com/performance/rules.html#expires
70+
71+
ExpiresActive On
72+
73+
# Data
74+
<FilesMatch \.(zip|gz|gzip|bz2|csv|xml)$>
75+
ExpiresDefault "access plus 0 seconds"
76+
</FilesMatch>
77+
ExpiresByType text/xml "access plus 0 seconds"
78+
ExpiresByType text/csv "access plus 0 seconds"
79+
ExpiresByType application/json "access plus 0 seconds"
80+
ExpiresByType application/zip "access plus 0 seconds"
81+
ExpiresByType application/x-gzip "access plus 0 seconds"
82+
ExpiresByType application/x-bzip2 "access plus 0 seconds"
83+
84+
# CSS, JavaScript
85+
<FilesMatch \.(css|js)$>
86+
ExpiresDefault "access plus 1 year"
87+
</FilesMatch>
88+
ExpiresByType text/css "access plus 1 year"
89+
ExpiresByType application/javascript "access plus 1 year"
90+
91+
# Favicon, images, flash
92+
<FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$>
93+
ExpiresDefault "access plus 1 year"
94+
</FilesMatch>
95+
ExpiresByType image/gif "access plus 1 year"
96+
ExpiresByType image/png "access plus 1 year"
97+
ExpiresByType image/jpg "access plus 1 year"
98+
ExpiresByType image/jpeg "access plus 1 year"
99+
ExpiresByType image/svg+xml "access plus 1 year"
100+
101+
# Fonts
102+
<FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>
103+
ExpiresDefault "access plus 1 year"
104+
</FilesMatch>
105+
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
106+
ExpiresByType application/x-font-ttf "access plus 1 year"
107+
ExpiresByType application/x-font-otf "access plus 1 year"
108+
ExpiresByType application/x-font-woff "access plus 1 year"
109+
ExpiresByType application/font-woff2 "access plus 1 year"
110+
111+
</IfModule>

0 commit comments

Comments
 (0)