server { listen 80; server_name {server_name}; root /var/www/vhosts/magento; location / { index index.php index.html index.htm; try_files $uri $uri/ @handler; } location @handler { rewrite / /index.php?$args; } location ~ (/(app/|includes/|pkginfo/|var/|errors/local.xml)|/\.) { deny all; } location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler rewrite ^(.*.php)/ $1 last; } location ~ \.php$ { fastcgi_pass phpfpm; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_read_timeout 90; include fastcgi_params; } }