Trying desperately to get CodeIgniter and Nginx to play nice. I was able to get it working once a long time ago and I cannot seem to reproduce what I had.

I am trying to follow:

However, it works fine where / gives me the default controller/method, and I can even get it to work with query strings ?c=controller&m=method ... But I cannot get the directory structure routing to work for anything!!

Here's my non-working version:

user nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log;
pid        /var/run/;

events {
  worker_connections  1024;

http {

  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;

  access_log    /var/log/nginx/access.log;

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;

  keepalive_timeout  65;

  gzip  on;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_proxied any;
  gzip_vary off;
  gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml;
  gzip_min_length  1000;
  gzip_disable     "MSIE [1-6]\.";

  server_names_hash_bucket_size 64;
  types_hash_max_size 2048;
  types_hash_bucket_size 64;

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;

    # The default server
    server {

        autoindex on;
        index index.php;

        # nginx configuration

        location / {
            try_files $uri $uri/ /index.php;


ok... so...
This code:

location / {
                try_files $uri $uri/ /index.php;

...says that if nginx can't find a file or a folder ($uri), it should redirect to index.php. You should try this:

location / {
    try_files $uri $uri/ @rewrites;

location @rewrites {
    if (!-e $request_filename)
        rewrite ^/(.*)$ /index.php/$1 last;

...which, I think, tells nginx to redirect to /index.php/{{whatever}}.

Also, you may try this:

location / {
    try_files $uri $uri/ /index.php?$query_string;