【问题标题】:configuring codeigniter on nginx在 nginx 上配置 codeigniter
【发布时间】:2015-08-20 08:20:52
【问题描述】:

我有我的 codeigniter 代码,我已经在 localhost 上设置了 nginx 服务器。但是codeigniter代码没有出现。显示所有页面的 404 not found 错误。 我搜索了一下,发现编辑 /etc/nginx/sites-available/default 是关键。

这是我在谷歌搜索文件后添加的代码,请告诉我我哪里错了,还有什么需要添加的。我是编辑此类文件的新手。我的项目代码在“usr/share/nginx/html/krshop”中。 谢谢!!

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;
 }
}

【问题讨论】:

  • 托管您的 codeigniter 的目录的名称是什么。我可以看到您的根目录位于 /usr/share/nginx/html/{codeigniter 文件夹}}

标签: codeigniter nginx


【解决方案1】:

可能这两个链接解决了你的问题,像这样的问题没有解决

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-16
    • 2017-03-15
    • 1970-01-01
    • 1970-01-01
    • 2015-06-02
    • 1970-01-01
    • 2016-08-23
    相关资源
    最近更新 更多