location / {
if ($host = 'static.chsmedien.com') {
root /paas/cxxxx/www/assets/;
}
try_files $uri $uri/ @modx-rewrite;
}location ~* \.(?:ico|gif|jpe?g|png)$ {
expires 355d;
# Serves static files in high resolution only if required
# Naming convention for high resolution images:
# [filename]@2x[extension], e.g.:
# [email protected]
set $hidpi_uri $1@2x$2;
if ($http_cookie !~ 'device-pixel-ratio=2') {
# If the device-pixel-ratio cookie is not set to 2, fall back to
# default behaviour, i.e. don't try to serve high resolution image
break;
}
# device-pixel-ratio cookie is set to 2
# Serve high resolution image if available,
# otherwise fall back to standard resolution
try_files $hidpi_uri $uri =404;
}# x-ua-xompatible header
add_header X-UA-Compatible IE=edge,chrome=1;
# expire headers for assets
# 1: images
location ~* \.(?:ico|gif|jpe?g|png)$ {
expires 355d;
# Serves static files in high resolution only if required
# Naming convention for high resolution images:
# [filename]@2x[extension], e.g.:
# [email protected]
set $hidpi_uri $1@2x$2;
if ($http_cookie !~ 'device-pixel-ratio=2') {
# If the device-pixel-ratio cookie is not set to 2, fall back to
# default behaviour, i.e. don't try to serve high resolution image
break;
}
# device-pixel-ratio cookie is set to 2
# Serve high resolution image if available,
# otherwise fall back to standard resolution
try_files $hidpi_uri $uri =404;
}
# 2: js/css
location ~* \.(?:js|css)$ {
expires 30d;
}
# Built-in filename-based cache busting
# This will route all requests for /css/style.20120716.css to /css/style.css
# Read also this: https://github.com/h5bp/html5-boilerplate/blob/master/doc/htaccess.md#cache-busting
location ~* (.+)\.(\d+)\.(js|css)$ {
try_files $uri $1.$3;
}
# modx furls rewrite
location / {
if ($host = 'static.chsmedien.com') {
root /paas/c0073/www/assets/;
break;
}
try_files $uri $uri/ @modx-rewrite;
}
if ($host = 'static.chsmedien.com') {
rewrite ^ /assets$uri last;
}
if ($host = "www.chsmedien.com") {
rewrite ^ $scheme://chsmedien.com$uri permanent;
}# x-ua-xompatible header
add_header X-UA-Compatible IE=edge,chrome=1;
if ($host = 'static.chsmedien.com') {
rewrite ^ /assets$uri last;
}
# expire headers for assets
# 1: images
location ~ ^(/images/[^\.]+)(\.(?:jpe?g|png|gif))$ {
expires 355d;
# Serves static files in high resolution only if required
# Naming convention for high resolution images:
# [filename]@2x[extension], e.g.:
# [email protected]
set $hidpi_uri $1@2x$2;
# disable this for testing...
# if ($http_cookie !~ 'device-pixel-ratio=2') {
# If the device-pixel-ratio cookie is not set to 2, fall back to
# default behaviour, i.e. don't try to serve high resolution image
# break;
# }
# device-pixel-ratio cookie is set to 2
# Serve high resolution image if available,
# otherwise fall back to standard resolution
try_files hidpi_uri $uri =404;
}
# 2: js/css
location ~* \.(?:js|css)$ {
expires 30d;
}
# Built-in filename-based cache busting
# This will route all requests for /css/style.20120716.css to /css/style.css
# Read also this: https://github.com/h5bp/html5-boilerplate/blob/master/doc/htaccess.md#cache-busting
location ~* (.+)\.(\d+)\.(js|css)$ {
try_files $uri $1.$3;
}
# rewrite blog/rss to feedburner
rewrite ^/blog/rss$ http://feeds.feedburner.com/chsmedien permanent;
# modx furls rewrite
location / {
try_files $uri $uri/ @modx-rewrite;
}# x-ua-xompatible header
add_header X-UA-Compatible IE=edge,chrome=1;
if ($host = "static.chsmedien.com") {
rewrite ^ /assets$uri;
}
location ~ ^(/assets/images/[^\.]+)(\.(?:jpe?g|png|gif))$ {
expires 365d;
# Serves static files in high resolution only if required
# Naming convention for high resolution images:
# [filename]@2x[extension], e.g.:
# [email protected]
set $hidpi_uri $1@2x$2;
if ($http_cookie !~ 'device-pixel-ratio=2') {
# If the device-pixel-ratio cookie is not set to 2, fall back to
# default behaviour, i.e. don't try to serve high resolution image
break;
}
# device-pixel-ratio cookie is set to 2
# Serve high resolution image if available,
# otherwise fall back to standard resolution
try_files $hidpi_uri $uri =404;
}
location ~* \.(?:js|css)$ {
expires 30d;
}
# rewrite blog/rss to feedburner
rewrite ^/blog/rss$ http://feeds.feedburner.com/chsmedien permanent;
# modx furls rewrite
location / {
try_files $uri $uri/ @modx-rewrite;
}# Built-in filename-based cache busting
# This will route all requests for /css/style.20120716.css to /css/style.css
# Read also this: https://github.com/h5bp/html5-boilerplate/blob/master/doc/htaccess.md#cache-busting
location ~* (.+)\.(\d+)\.(js|css)$ {
try_files $uri $1.$3;
}