绛色红缨 发表于 2014-4-18 17:43:35

lnmp 下配置ci (去index.php)

今天遇到一个问题。在ubuntu 13.4下,运行ci。无法正常运行。查找了一下原因是因为index.php原因。发了一下午时间。终于解决啦。将经验分享大家

server
    {
      listen       80;
      server_name admin.cc;
      index index.html index.htm index.php default.html default.htm default.php;
      root/home/wwwroot/admin.cc;
      include other.conf;

      location / {
            index index.php;
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?$1 last;
                break;
            }   
      }
      location ~ .*\.(php|php5)?$
            {
                try_files $uri =404;
                fastcgi_passunix:/tmp/php-cgi.sock;
                fastcgi_index index.php;
                include fcgi.conf;
            }

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

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

      access_log/home/wwwlogs/admin.cc.logadmin.cc;
    }

主要是这段代码:

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


燃雲 发表于 2014-4-20 11:35:39

Linux, Nginx, MySQL及PHP组合一般称为LEMP,因Nginx念作Engine-X。

LAMP,LEMP皆可发音,LNMP无法发音,必须每个字母都念出来,并不方便。别见字母便拿字母来作简称。

smartweb 发表于 2014-5-1 09:04:02

LEMP?
LNMP吧。
LANMP
页: [1]
查看完整版本: lnmp 下配置ci (去index.php)