在nginx上配置codeigniter

时间:2015-08-20 08:20:53

标签: codeigniter nginx

我有codeigniter代码,我在localhost上设置了nginx服务器。但是codeigniter代码并没有显示出来。显示所有页面的404未找到错误。 我用Google搜索并了解编辑/ etc / nginx / sites-available / default是关键。

这是我在google搜索文件后添加的代码,请告诉我哪里错了,还有什么需要添加。我是编辑这些文件的完全新手。我的项目代码在&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 个答案:

答案 0 :(得分:0)

可能这两个链接解决了你的问题,这个问题尚未解决

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

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