Skip to content

Instantly share code, notes, and snippets.

@mklooss
Created October 8, 2012 11:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mklooss/3852036 to your computer and use it in GitHub Desktop.
Save mklooss/3852036 to your computer and use it in GitHub Desktop.
nginx Configuration Magento
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 5h;
}
location ^~ /media/ {
expires max;
}
location ^~ /skin/ {
expires max;
}
location ^~ /js/ {
expires max;
}
## These locations would be hidden by .htaccess normally
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 @handler {
rewrite / /index.php;
}
# HIDDEN FILES
location ~ ^(.*)\/\.(.*)$ {
return 404;
}
# PHP-FPM
location ~ ^(.*)\.php$ {
if (!-f $request_filename) {
return 404;
}
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-magento-fpm.sock;
fastcgi_param MAGE_RUN_CODE base;
fastcgi_param MAGE_RUN_TYPE website;
}
@mklooss
Copy link
Author

mklooss commented Oct 8, 2012

When php-fpm result is empty, you have to add the following line to your configuration:

fastcgi_param  SCRIPT_FILENAME    $document_root/$fastcgi_script_name;```

@mklooss
Copy link
Author

mklooss commented Oct 8, 2012

fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment