Skip to content

Instantly share code, notes, and snippets.

@korbax
Last active July 25, 2016 08:58
Show Gist options
  • Save korbax/742d751cce26cbbb80e4cc8bb80ecd8d to your computer and use it in GitHub Desktop.
Save korbax/742d751cce26cbbb80e4cc8bb80ecd8d to your computer and use it in GitHub Desktop.

Revisions

  1. korbax revised this gist Jul 25, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -34,11 +34,11 @@ server {
    # Don't log robots.txt requests
    location = /robots.txt {

    if ($host = 'www.site.com') {
    if ($host = 'www.site.com') {
    rewrite ^/robots\.txt /seo/en/site.com/robots.txt last;
    }

    if ($host = 'www.second.com') {
    if ($host = 'www.second.com') {
    rewrite ^/robots\.txt /seo/en/second.com/robots.txt last;
    }

  2. korbax revised this gist Jul 25, 2016. 1 changed file with 34 additions and 34 deletions.
    68 changes: 34 additions & 34 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -69,29 +69,29 @@ server {
    }

    location / {
    # Кешировать указанные коды ответов 5 минут
    proxy_cache_valid 200 301 302 304 5m;
    # Ключ по которому сохраняются и берутся данные из кеша
    proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
    # Защита от раздачи одинаковой куки в кешированном ответе
    proxy_hide_header "Set-Cookie";
    # Игнорировать параметры кеша заданные бекэндом
    proxy_ignore_headers "Cache-Control" "Expires";

    # Указывает в каких случаях клиенту можно отдать несвежий ответ из кеша
    proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;

    # активировать зону кеширования pagecache
    proxy_cache pagecache;
    # Кешировать указанные коды ответов 5 минут
    proxy_cache_valid 200 301 302 304 5m;
    # Ключ по которому сохраняются и берутся данные из кеша
    proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
    # Защита от раздачи одинаковой куки в кешированном ответе
    proxy_hide_header "Set-Cookie";
    # Игнорировать параметры кеша заданные бекэндом
    proxy_ignore_headers "Cache-Control" "Expires";

    # Указывает в каких случаях клиенту можно отдать несвежий ответ из кеша
    proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;

    try_files $uri $uri/ /index.php?$args; # make index.php handle requests for /
    access_log off; # do not log access to static files
    expires max; # cache static files aggressively
    # активировать зону кеширования pagecache
    proxy_cache pagecache;

    try_files $uri $uri/ /index.php?$args; # make index.php handle requests for /
    access_log off; # do not log access to static files
    expires max; # cache static files aggressively
    }

    location @appserver {
    proxy_pass
    http://127.0.0.1:8080;
    proxy_pass
    http://127.0.0.1:8080;
    }

    location ^~ /app/ { deny all; }
    @@ -116,21 +116,21 @@ server {
    fastcgi_pass phpsock;
    }

    location ~ .php$ {
    include /etc/nginx/conf.d/headers.conf;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass phpsock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_connect_timeout 180;
    fastcgi_cache fcgi;
    fastcgi_cache_valid 200 60m;

    fastcgi_param MAGE_RUN_TYPE website;
    fastcgi_param MAGE_RUN_CODE $mage_run_code;
    }
    location ~ .php$ {
    include /etc/nginx/conf.d/headers.conf;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass phpsock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_connect_timeout 180;
    fastcgi_cache fcgi;
    fastcgi_cache_valid 200 60m;
    fastcgi_param MAGE_RUN_TYPE website;
    fastcgi_param MAGE_RUN_CODE $mage_run_code;
    }


    location @cache_miss {
  3. korbax revised this gist Jul 25, 2016. 1 changed file with 85 additions and 87 deletions.
    172 changes: 85 additions & 87 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -47,75 +47,74 @@ server {
    access_log off;
    }

    # Rewrite for versioned CSS+JS via filemtime
    location ~* ^.+\.(css|js)$ {
    rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
    expires 31536000s;
    access_log off;
    log_not_found off;
    add_header Pragma public;
    add_header Cache-Control "max-age=31536000, public";
    }

    # Aggressive caching for static files
    # If you alter static files often, please use
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
    expires 31536000s;
    access_log off;
    log_not_found off;
    add_header Pragma public;
    add_header Cache-Control "max-age=31536000, public";
    }

    location / {

    # Кешировать указанные коды ответов 5 минут
    proxy_cache_valid 200 301 302 304 5m;
    # Ключ по которому сохраняются и берутся данные из кеша
    proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
    # Защита от раздачи одинаковой куки в кешированном ответе
    proxy_hide_header "Set-Cookie";
    # Игнорировать параметры кеша заданные бекэндом
    proxy_ignore_headers "Cache-Control" "Expires";

    # Указывает в каких случаях клиенту можно отдать несвежий ответ из кеша
    proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;

    # активировать зону кеширования pagecache
    proxy_cache pagecache;

    try_files $uri $uri/ /index.php?$args; # make index.php handle requests for /
    access_log off; # do not log access to static files
    expires max; # cache static files aggressively
    }
    # Rewrite for versioned CSS+JS via filemtime
    location ~* ^.+\.(css|js)$ {
    rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
    expires 31536000s;
    access_log off;
    log_not_found off;
    add_header Pragma public;
    add_header Cache-Control "max-age=31536000, public";
    }

    location @appserver {
    proxy_pass
    http://127.0.0.1:8080;
    }
    # Aggressive caching for static files
    # If you alter static files often, please use
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
    expires 31536000s;
    access_log off;
    log_not_found off;
    add_header Pragma public;
    add_header Cache-Control "max-age=31536000, public";
    }

    location ^~ /app/ { deny all; }
    location ^~ /includes/ { deny all; }
    location ^~ /lib/ { deny all; }
    location ^~ /media/downloadable/ { deny all; }
    location ^~ /pkginfo/ { deny all; }
    location ^~ /report/config.xml { deny all; }
    location ^~ /var/ { deny all; }

    location /var/export/ { ## Allow admins only to view export folder
    auth_basic "Restricted"; ## Message shown in login window
    auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
    autoindex on;
    }
    location / {
    # Кешировать указанные коды ответов 5 минут
    proxy_cache_valid 200 301 302 304 5m;
    # Ключ по которому сохраняются и берутся данные из кеша
    proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
    # Защита от раздачи одинаковой куки в кешированном ответе
    proxy_hide_header "Set-Cookie";
    # Игнорировать параметры кеша заданные бекэндом
    proxy_ignore_headers "Cache-Control" "Expires";

    # Указывает в каких случаях клиенту можно отдать несвежий ответ из кеша
    proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;

    # активировать зону кеширования pagecache
    proxy_cache pagecache;

    try_files $uri $uri/ /index.php?$args; # make index.php handle requests for /
    access_log off; # do not log access to static files
    expires max; # cache static files aggressively
    }

    location /\. {
    return 404;
    }
    location @appserver {
    proxy_pass
    http://127.0.0.1:8080;
    }

    location @proxy {
    fastcgi_pass phpsock;
    }
    location ^~ /app/ { deny all; }
    location ^~ /includes/ { deny all; }
    location ^~ /lib/ { deny all; }
    location ^~ /media/downloadable/ { deny all; }
    location ^~ /pkginfo/ { deny all; }
    location ^~ /report/config.xml { deny all; }
    location ^~ /var/ { deny all; }

    location /var/export/ { ## Allow admins only to view export folder
    auth_basic "Restricted"; ## Message shown in login window
    auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
    autoindex on;
    }

    location /\. {
    return 404;
    }

    location @proxy {
    fastcgi_pass phpsock;
    }

    location ~ .php$ {
    include /etc/nginx/conf.d/headers.conf;
    @@ -134,26 +133,25 @@ server {
    }


    location @cache_miss {
    # are we using a reverse proxy? proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host; proxy_redirect off;
    proxy_max_temp_file_size 0;

    #configure fastcgi
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_send_timeout 5m;
    fastcgi_read_timeout 5m;
    fastcgi_connect_timeout 5m;
    fastcgi_buffer_size 256k;
    fastcgi_buffers 4 512k;
    fastcgi_busy_buffers_size 768k;
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param PHP_VALUE "memory_limit = 32M";
    fastcgi_param PHP_VALUE "max_execution_time = 18000";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    location @cache_miss {
    # are we using a reverse proxy? proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host; proxy_redirect off;
    proxy_max_temp_file_size 0;

    #configure fastcgi
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_send_timeout 5m;
    fastcgi_read_timeout 5m;
    fastcgi_connect_timeout 5m;
    fastcgi_buffer_size 256k;
    fastcgi_buffers 4 512k;
    fastcgi_busy_buffers_size 768k;
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param PHP_VALUE "memory_limit = 32M";
    fastcgi_param PHP_VALUE "max_execution_time = 18000";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }
  4. korbax revised this gist Jul 25, 2016. 1 changed file with 27 additions and 27 deletions.
    54 changes: 27 additions & 27 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -14,38 +14,38 @@ server {
    }

    server {
    listen 80 default;
    server_name www.site.com www.second.com;
    root /var/www/site.com;
    index index.php;
    autoindex off;
    listen 80 default;
    server_name www.site.com www.second.com;
    root /var/www/site.com;
    index index.php;
    autoindex off;

    client_max_body_size 15m;
    client_max_body_size 15m;
    client_body_buffer_size 128k;

    expires 86400s;
    expires 86400s;
    add_header Pragma public;
    add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.xml)\|/\.svn/\|/\.git/\|/.hta.+) {
    deny all; #ensure sensitive files are not accessible
    }

    # Don't log robots.txt requests
    location = /robots.txt {

    if ($host = 'www.site.com') {
    rewrite ^/robots\.txt /seo/en/site.com/robots.txt last;
    }

    if ($host = 'www.second.com') {
    rewrite ^/robots\.txt /seo/en/second.com/robots.txt last;
    }
    allow all;
    log_not_found off;
    access_log off;
    }
    location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.xml)\|/\.svn/\|/\.git/\|/.hta.+) {
    deny all; #ensure sensitive files are not accessible
    }

    # Don't log robots.txt requests
    location = /robots.txt {
    if ($host = 'www.site.com') {
    rewrite ^/robots\.txt /seo/en/site.com/robots.txt last;
    }
    if ($host = 'www.second.com') {
    rewrite ^/robots\.txt /seo/en/second.com/robots.txt last;
    }
    allow all;
    log_not_found off;
    access_log off;
    }

    # Rewrite for versioned CSS+JS via filemtime
    location ~* ^.+\.(css|js)$ {
  5. korbax revised this gist Jul 25, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,13 @@ map $http_host $mage_run_code {
    }

    server {
    server_name site.com;
    return 301 $scheme://www.site.com$request_uri;
    server_name site.com;
    return 301 $scheme://www.site.com$request_uri;
    }

    server {
    server_name second.com;
    return 301 $scheme://www.second.com$request_uri;
    server_name second.com;
    return 301 $scheme://www.second.com$request_uri;
    }

    server {
  6. korbax revised this gist Jul 25, 2016. 1 changed file with 22 additions and 22 deletions.
    44 changes: 22 additions & 22 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -1,35 +1,35 @@
    map $http_host $mage_run_code {
    .site.com base;
    .second.com second_store;
    .site.com base;
    .second.com second_store;
    }

    server {
    server_name site.com;
    return 301 $scheme://www.site.com$request_uri;
    server_name site.com;
    return 301 $scheme://www.site.com$request_uri;
    }

    server {
    server_name second.com;
    return 301 $scheme://www.second.com$request_uri;
    server_name second.com;
    return 301 $scheme://www.second.com$request_uri;
    }

    server {
    listen 80 default;
    server_name www.site.com www.second.com;
    root /var/www/site.com;
    index index.php;
    autoindex off;

    client_max_body_size 15m;
    client_body_buffer_size 128k;

    expires 86400s;
    add_header Pragma public;
    add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.xml)\|/\.svn/\|/\.git/\|/.hta.+) {
    deny all; #ensure sensitive files are not accessible
    }
    listen 80 default;
    server_name www.site.com www.second.com;
    root /var/www/site.com;
    index index.php;
    autoindex off;

    client_max_body_size 15m;
    client_body_buffer_size 128k;

    expires 86400s;
    add_header Pragma public;
    add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.xml)\|/\.svn/\|/\.git/\|/.hta.+) {
    deny all; #ensure sensitive files are not accessible
    }

    # Don't log robots.txt requests
    location = /robots.txt {
  7. korbax created this gist Jul 25, 2016.
    101 changes: 101 additions & 0 deletions index.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,101 @@
    <?php
    /**
    * Magento
    *
    * NOTICE OF LICENSE
    *
    * This source file is subject to the Open Software License (OSL 3.0)
    * that is bundled with this package in the file LICENSE.txt.
    * It is also available through the world-wide-web at this URL:
    * http://opensource.org/licenses/osl-3.0.php
    * If you did not receive a copy of the license and are unable to
    * obtain it through the world-wide-web, please send an email
    * to [email protected] so we can send you a copy immediately.
    *
    * DISCLAIMER
    *
    * Do not edit or add to this file if you wish to upgrade Magento to newer
    * versions in the future. If you wish to customize Magento for your
    * needs please refer to http://www.magentocommerce.com for more information.
    *
    * @category Mage
    * @package Mage
    * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
    * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
    */

    if (version_compare(phpversion(), '5.2.0', '<')===true) {
    echo '<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
    <h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">
    Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer.
    <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a>
    Magento using PHP-CGI as a work-around.</p></div>';
    exit;
    }

    /**
    * Error reporting
    */
    error_reporting(E_ALL | E_STRICT);

    /**
    * Compilation includes configuration file
    */
    define('MAGENTO_ROOT', getcwd());

    $compilerConfig = MAGENTO_ROOT . '/includes/config.php';
    if (file_exists($compilerConfig)) {
    include $compilerConfig;
    }

    $mageFilename = MAGENTO_ROOT . '/app/Mage.php';
    $maintenanceFile = 'maintenance.flag';

    if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
    header("Location: downloader");
    } else {
    echo $mageFilename." was not found";
    }
    exit;
    }

    if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
    }

    require_once $mageFilename;

    #Varien_Profiler::enable();

    if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
    }

    ini_set('display_errors', 0);

    umask(0);

    /* Store or website code */
    $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

    /* Run store or run website */
    $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

    switch($_SERVER['HTTP_HOST']){
    case 'site.com':
    case 'www.site.com':
    Mage::run('base', 'website');
    break;
    case 'second.com':
    case 'www.second.com':
    Mage::run('second_store', 'website');
    break;
    default:
    Mage::run($mageRunCode, $mageRunType);
    break;
    }

    //Mage::run($mageRunCode, $mageRunType);
    159 changes: 159 additions & 0 deletions site.com.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,159 @@
    map $http_host $mage_run_code {
    .site.com base;
    .second.com second_store;
    }

    server {
    server_name site.com;
    return 301 $scheme://www.site.com$request_uri;
    }

    server {
    server_name second.com;
    return 301 $scheme://www.second.com$request_uri;
    }

    server {
    listen 80 default;
    server_name www.site.com www.second.com;
    root /var/www/site.com;
    index index.php;
    autoindex off;

    client_max_body_size 15m;
    client_body_buffer_size 128k;

    expires 86400s;
    add_header Pragma public;
    add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.xml)\|/\.svn/\|/\.git/\|/.hta.+) {
    deny all; #ensure sensitive files are not accessible
    }

    # Don't log robots.txt requests
    location = /robots.txt {

    if ($host = 'www.site.com') {
    rewrite ^/robots\.txt /seo/en/site.com/robots.txt last;
    }

    if ($host = 'www.second.com') {
    rewrite ^/robots\.txt /seo/en/second.com/robots.txt last;
    }

    allow all;
    log_not_found off;
    access_log off;
    }

    # Rewrite for versioned CSS+JS via filemtime
    location ~* ^.+\.(css|js)$ {
    rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
    expires 31536000s;
    access_log off;
    log_not_found off;
    add_header Pragma public;
    add_header Cache-Control "max-age=31536000, public";
    }

    # Aggressive caching for static files
    # If you alter static files often, please use
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
    expires 31536000s;
    access_log off;
    log_not_found off;
    add_header Pragma public;
    add_header Cache-Control "max-age=31536000, public";
    }

    location / {

    # Кешировать указанные коды ответов 5 минут
    proxy_cache_valid 200 301 302 304 5m;
    # Ключ по которому сохраняются и берутся данные из кеша
    proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
    # Защита от раздачи одинаковой куки в кешированном ответе
    proxy_hide_header "Set-Cookie";
    # Игнорировать параметры кеша заданные бекэндом
    proxy_ignore_headers "Cache-Control" "Expires";

    # Указывает в каких случаях клиенту можно отдать несвежий ответ из кеша
    proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;

    # активировать зону кеширования pagecache
    proxy_cache pagecache;

    try_files $uri $uri/ /index.php?$args; # make index.php handle requests for /
    access_log off; # do not log access to static files
    expires max; # cache static files aggressively
    }

    location @appserver {
    proxy_pass
    http://127.0.0.1:8080;
    }

    location ^~ /app/ { deny all; }
    location ^~ /includes/ { deny all; }
    location ^~ /lib/ { deny all; }
    location ^~ /media/downloadable/ { deny all; }
    location ^~ /pkginfo/ { deny all; }
    location ^~ /report/config.xml { deny all; }
    location ^~ /var/ { deny all; }

    location /var/export/ { ## Allow admins only to view export folder
    auth_basic "Restricted"; ## Message shown in login window
    auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
    autoindex on;
    }

    location /\. {
    return 404;
    }

    location @proxy {
    fastcgi_pass phpsock;
    }

    location ~ .php$ {
    include /etc/nginx/conf.d/headers.conf;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass phpsock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_connect_timeout 180;
    fastcgi_cache fcgi;
    fastcgi_cache_valid 200 60m;

    fastcgi_param MAGE_RUN_TYPE website;
    fastcgi_param MAGE_RUN_CODE $mage_run_code;
    }


    location @cache_miss {
    # are we using a reverse proxy? proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host; proxy_redirect off;
    proxy_max_temp_file_size 0;

    #configure fastcgi
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_send_timeout 5m;
    fastcgi_read_timeout 5m;
    fastcgi_connect_timeout 5m;
    fastcgi_buffer_size 256k;
    fastcgi_buffers 4 512k;
    fastcgi_busy_buffers_size 768k;
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param PHP_VALUE "memory_limit = 32M";
    fastcgi_param PHP_VALUE "max_execution_time = 18000";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    }