server { listen 80; server_name $http_host; root /var/www/$http_host; location / { index index.html index.php; try_files $uri $uri/ @handler; expires 30d; } location /. { return 404; } location @handler { rewrite / /index.php; } location ~ .php/ { rewrite ^(.*.php)/ $1 last; } location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_TYPE store; include fastcgi_params; } }