server {
  listen 80;
  server_name example.com;
  root /PATH_TO_ROOT;
  index index.php;

  location / {
    index index.php;
    try_files $uri $uri/ @ee;
  }

  location @ee {
    rewrite ^(.*) /index.php$1 last;
  }

  location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass unix:/tmp/php-fastcgi.socket;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

    # This location is for our EE index.php gateway
    location /index.php {
      include /usr/local/nginx/conf/fastcgi_params;
      set $script     $uri;
      set $path_info  $uri;
      # this will set the path_info when it exists as query string: /index.php?/something/here
      if ($args ~* "^(/.+)$") {
        set $path_info  $1;
      }
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $path_info;
    }
}
