Created
October 8, 2012 11:31
-
-
Save mklooss/3852036 to your computer and use it in GitHub Desktop.
nginx Configuration Magento
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
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
When php-fpm result is empty, you have to add the following line to your configuration: