Milan Kumar
Milan Kumar

Reputation: 77

configuring codeigniter on nginx

I have my codeigniter code and I have setup nginx server on localhost. But codeigniter code doesn't show up. Shows 404 not found error for all pages. I googled around and came to know that editing /etc/nginx/sites-available/default was the key.

Here is the code I added after googling to the file, please tell me where am I wrong and what else needs to be added. I am a complete newbie to editing such files. My code for the project is in 'usr/share/nginx/html/krshop'. Thanxx!!

server {
server_name localhost;
root /usr/share/nginx/html/;
index index.php index.html index.htm;
location / {
    try_files $uri $uri/ /index.php;
}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
    expires           15d;
}

location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html/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   unix:/var/run/php5-fpm.sock;
 }
}

Upvotes: 0

Views: 2662

Answers (1)

JAVA_RMI
JAVA_RMI

Reputation: 139

May be these two links solves your problem,question like this are unsolved

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

https://gist.github.com/lynxluna/1050850

Upvotes: 1

Related Questions