Nginx Configuration for CodeIgniter

Suppose the CodeIgniter application is in /opes. Add the following configuration.

location /opes/index.php {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

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

    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root/opes/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;
}

* This configuration assumes we do not hide index.php in the URL.

Reference

http://www.farinspace.com/codeigniter-nginx-rewrite-rules/