# NGINX # FILE: /usr/local/etc/nginx/conf.d/magento.conf # Forward Fooman Speedster requests to minify controller location /minify/ { rewrite ^/minify/([0-9]+)(/.*\.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last; } # Show correct errors caused when a store owner enables built-in minification location /skin/m/ { rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last; } # Directives to send expires headers and turn off 404 error logging for Static assets location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpe?g|gif|png|ico|zip|pdf|t?gz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|swf|bmp|txt|rtf|md)$ { access_log off; log_not_found off; expires max; # CORS headers; this is wide-open, you want to tight it up a bit add_header Cache-Control public; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods GET,OPTIONS; add_header Access-Control-Allow-Headers *; } # Deny access to files the public doesn't need location ^~ /(app|config|includes|lib|media/customer|media/downloadable|pkginfo|report/config.xml|shell|var)/ { internal; } # Attempt to serve the request by trying direct file, directory, Magento front controller location / { try_files $uri $uri/ /index.php?$args; } # The downloader has its own index.php that needs to be used location ~* ^(/downloader)(.*) { try_files $uri $uri/ /downloader/index.php$1; } # REST API endpoint location /api { rewrite ^/api/rest /api.php?type=rest last; rewrite ^/api/v2_soap /api.php?type=v2_soap last; rewrite ^/api/soap /api.php?type=soap last; } # Pass PHP scripts to PHP-FPM daemon # Check: http://wiki.nginx.org/Pitfalls location ~* \.php$ { # filter out problem conditions try_files $uri $uri/ =404; # bring in parameters include conf.d/fastcgi.conf; fastcgi_param MAGE_IS_DEVELOPER_MODE true; fastcgi_param MAGE_RUN_CODE default; fastcgi_param MAGE_RUN_TYPE store; # send requests to Upstream, but blacklist media location from fastcgi if ($uri !~ "^/(media)/") { fastcgi_pass phpfpm; } }