(Yes, I decided to write a post in english, as this might be useful for a lot of people).

Today I lost some time trying to set up code igniter with fastcgi and an nginx server. Google wasn't really helpful but I found a part of the answer on this thread in the ci forums but I had to dig through the nginx and ci config files. Here is what I have finally done to make this work.

First you have to set up a rewrite rule if you want ci's nice urls (example.com/controller/method/param). I assume you use different vhost files with a specific server directive in each. So, in your nginx config file, configure your server_name, logs, and listen directives as usual, then use this for the / location :

  location /
  {
    index index.php;
    root  /path/to/your/ci/directory;

    if ($request_filename !~ (js|css|images|robots\.txt|index\.php.*) ) {
      rewrite ^/(.*)$ /index.php/$1 last;
    }
  }


Replace the root param with your web directory, which will contain your static files. You can modify the $request_filename regexp to exclude files and directories (if you have a files/ directory for example) from the rewrite.
Note the ^/ in the regexp part from the rewrite, this will avoid getting urls like /index.php//method. I don't know if this is mandatory as the user won't see this rewrite.

Then, add this :

  location ~ /index.php/
  {
    include /usr/local/nginx/conf/fastcgi.conf;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /path/to/your/index.php;
    fastcgi_param  REQUEST_URI      $request_uri;
    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_pass   127.0.0.1:9000;
  }


This will redirect queries to /index.php/* to your fastcgi thread. I had to use the location directive because nginx doesn't allow to change fastcgi_params within a rewrite directive.
Some fastcgi_params could not be necessary for you depending on your fastcgi.conf. Of course you have to adapt the include and fastcgi_pass directives for your setup. This website : http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/ will provide additional informations on php+fastcgi if you need. You can also see the nginx documentation.
Note that the SCRIPT_FILENAME parameter points directly to your index.php file, not to $fastcgi_script_name as usual.

You can now test this setup, which should work... Err, not really. You can see your default controller but your queries to other methods arn't working. CI does not see your request, so you'll have to change his configuration.

Edit the (system/)application/config/config.php file and look for the $config['uri_protocol'] config option. Change it to :
$config['uri_protocol']  = "REQUEST_URI";
Now CI can retrieve the full URI and your application should work fine.

I hope this can be useful for someone :)