Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

nginx and fastcgi_params config problem - index.php in url returns 404
Jr. Member
Total Posts:  13
Joined:  2011-11-09

Hello Magentoer’s,

I need some help.  I’m running EE 1.13.01 on nginx with fast_cgi and php-fpm. 

My site works perfectly on front and backend with rewrite on.  However, if I try to go to or which are both valid urls, then Magento returns 404, page not found. works just fine, but I cannot use “index.php” in the url without a 404 error.

See my fastcgi_params below, which is included in my site’s nginx conf file.  If you see the issue either in fastcgi_params or nginx conf that is preventing me from using “index.php” in my url calls, such as, I’d much appreciate it.  I feel like it is something in fastcgi_param, but I haven’t narrowed it down yet.  i.e. fastcgi_param SCRIPT_NAME, is that correct?

#fastcgi_params (included in nginx conf file below)
fastcgi_split_path_info           ^(.+\.php)(.*)$;
fastcgi_param  SCRIPT_NAME        $document_root$fastcgi_script_name# I feel like this may be the problem???????
fastcgi_param  PATH_INFO          $fastcgi_path_info;
fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_script_name;

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
#fastcgi_param  HTTPS              $https if_not_empty;
fastcgi_param  HTTPS              $http_https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $http_host;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

#fastcgi_connect_timeout 60;
#fastcgi_send_timeout 120;
#fastcgi_read_timeout 120;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

fastcgi_index                     index.php;
fastcgi_ignore_client_abort       on;

fastcgi_pass   unix:/var/run/php-fpm.sock;

#nginx conf file (see it is including the fastcgi_params)

server {
server_name_in_redirect off;
        if (
$host '') {
^(.*)$$1 permanent;
index index.php;

error_log /var/log/nginx/ notice;
access_log /var/log/nginx/ main;

fastcgi_intercept_errors off;

location {
                index index
.html index.php;
try_files $uri $uri/ @handler;
expires 30d;

# Deny all attempts to access hidden files
        # such as .htaccess, .htpasswd, etc...
location ~ /\{
                deny all
access_log off;
log_not_found off;

^~ /(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal}
/var/export{ internal}
/. return 404}

~ /dash {
auth_basic_user_file htpasswd/;
location \.php{
include fastcgi_params;

~ /mysite_market {
auth_basic_user_file htpasswd/;
location \.php{
include fastcgi_params;

# This redirect is added so to use Magentos
        # common front handler when handling incoming URLs.
location @handler { rewrite / /index.php}

# Forward paths such as /js/index.php/x.js
        # to their relevant handler.
location ~* .php{ rewrite ^(.*.php)/ $1 last}

~* .php{
if (!-e $request_filename{ rewrite / /index.php last}
                expires off
fastcgi_param PHP_VALUE session.save_handler=memcache;
fastcgi_param PHP_VALUE session.save_path="tcp://mymemcached:port?persistent=1&weight;=1&timeout;=1&retry;_interval=15";
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
fastcgi_param PHP_VALUE "max_input_vars=4000";
fastcgi_param PHP_VALUE "display_errors=off";
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top