Installing Codeigniter on Nginx

June 3, 2011 by admin · Leave a Comment 

A good tutorial on how to install Codeigniter on Nginx:

server {
    listen   80;
    server_name  domain.com;
    location ~ /\. {
        deny all;
    }
    rewrite ^/(.*) http://www.domain.com/$1 permanent;
}
server {
    listen   80;
    server_name  www.domain.com;
    access_log /path/to/your/app/log/access.log;
    error_log /path/to/your/app/log/error.log;

    location ~ /\. {
        deny all;
    }

    location / {
        index index.php;
        root /path/to/your/app/public;
        if (!-e $request_filename) {
             rewrite ^/(.*)$ /index.php/$1 last;
        }
    }

    location ~ /index.php/ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        include         /usr/local/nginx/conf/fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME     /path/to/your/app/public/$fastcgi_script_name;
    }
}

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

*