Koken + Nginx Yapılandırması
## Gzipport_in_redirect off;gzip on;gzip_static on;gzip_buffers 4 128k;gzip_comp_level 1;gzip_http_version 1.0;gzip_min_length 0;#gzip_types text/plain application/x-javascript text/xml text/css;gzip_vary on;gzip_typesapplication/atom+xmlapplication/javascriptapplication/jsonapplication/ld+jsonapplication/manifest+jsonapplication/rdf+xmlapplication/rss+xmlapplication/schema+jsonapplication/vnd.geo+jsonapplication/vnd.ms-fontobjectapplication/x-font-ttfapplication/x-javascriptapplication/x-web-app-manifest+jsonapplication/xhtml+xmlapplication/xmlfont/eotfont/opentypeimage/bmpimage/svg+xmlimage/vnd.microsoft.iconimage/x-icontext/cache-manifesttext/csstext/javascripttext/plaintext/vcardtext/vnd.rim.location.xloctext/vtttext/x-componenttext/x-cross-domain-policytext/xml;# By default, do not set expire headersexpires 0;# Set expires header for console CSS and JS.# These files are timestamped with each new release, so it is safe to cache them agressively.location ~ "console_.*\.(js|css)$" {expires max;}# Catch image requests and pass them back to PHP if a cache does not yet existlocation ~ "^/storage/cache/images(/(([0-9]{3}/[0-9]{3})|custom)/.*)$" {# Cached images have timestamps in the URL, so it is safe to set# aggresive cache headers here.expires max;try_files $uri /i.php?path=$1;}# Catch .css.lens requests and serve cache when possiblelocation ~ "(lightbox-)?settings.css.lens$" {default_type text/css;try_files /storage/cache/site/${uri} /app/site/site.php?url=/$1settings.css.lens;}# Catch koken.js requests and serve cache when possiblelocation ~ koken.js$ {default_type text/javascript;try_files /storage/cache/site/${uri} /app/site/site.php?url=/koken.js;}# PJAX requests contain the _pjax GET parameter and are cached with .phtml extensionsif ($arg__pjax) {set $cache_ext 'phtml';}# Do not check for a cache for non-GET requestsif ($request_method != 'GET') {set $cache_ext 'nocache';}# If share_to_tumblr cookie is preset, disable caching (long story)if ($http_cookie ~* "share_to_tumblr" ) {set $cache_ext 'nocache';}# Catch root requestslocation ~ ^/?$ {try_files /storage/cache/site/index/cache.$cache_ext /app/site/site.php?url=/;}# All other requests get passed back to Koken unless file already existslocation / {try_files $uri $uri/ /storage/cache/site/${uri} /storage/cache/site/${uri}cache.$cache_ext /app/site/site.php?url=$uri&$args;}location ~ \.php$ {try_files $uri =404;fastcgi_pass unix:/var/run/php5-fpm.com.sock;}
#Thanks.
[1]https://gist.github.com/bradleyboy/26ffd2ec7da68919ecd1
Comments
Leave a Comment