用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4503|回复: 2
收起左侧

[服务器] lnmp 下配置ci (去index.php)

[复制链接]
发表于 2014-4-18 17:43:35 | 显示全部楼层 |阅读模式
今天遇到一个问题。在ubuntu 13.4下,运行ci。无法正常运行。查找了一下原因是因为index.php原因。发了一下午时间。终于解决啦。将经验分享大家

  1. server
  2.     {
  3.         listen       80;
  4.         server_name admin.cc;
  5.         index index.html index.htm index.php default.html default.htm default.php;
  6.         root  /home/wwwroot/admin.cc;
  7.         include other.conf;

  8.         location / {
  9.             index index.php;
  10.             if (!-e $request_filename) {
  11.                 rewrite ^/(.*)$ /index.php?$1 last;
  12.                 break;
  13.             }   
  14.         }
  15.         location ~ .*\.(php|php5)?$
  16.             {
  17.                 try_files $uri =404;
  18.                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  19.                 fastcgi_index index.php;
  20.                 include fcgi.conf;
  21.             }

  22.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  23.             {
  24.                 expires      30d;
  25.             }

  26.         location ~ .*\.(js|css)?$
  27.             {
  28.                 expires      12h;
  29.             }

  30.         access_log  /home/wwwlogs/admin.cc.log  admin.cc;
  31.     }
复制代码

主要是这段代码:

  1. location / { # 注意这里写 “/" 如果有子目录则是 /forlde/ 即可
  2.             index index.php;
  3.             if (!-e $request_filename) {
  4.                 rewrite ^/(.*)$ /index.php?$1 last; # 关键代码
  5.                 break; # 必须加break 跳出
  6.             }   
  7.   }
复制代码


发表于 2014-4-20 11:35:39 | 显示全部楼层
Linux, Nginx, MySQL及PHP组合一般称为LEMP,因Nginx念作Engine-X。

LAMP,LEMP皆可发音,LNMP无法发音,必须每个字母都念出来,并不方便。别见字母便拿字母来作简称。
发表于 2014-5-1 09:04:02 | 显示全部楼层
LEMP?
LNMP吧。
LANMP

本版积分规则