0

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;
 }
}
1
  • what is the name of the directory hosting your codeigniter. I can see that your root is at /usr/share/nginx/html/{the codeigniter folder}} Commented Feb 8, 2017 at 11:01

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.