CI 框架Linux 下 Nginx 配置

Linux 下环境各有不同,根据实际情况来

server {
        listen       80;
        server_name  ****.com;
    index index.html index.htm index.php;
    root /home/;

  #nginx去掉index.php
      location / {
         rewrite ^/(?!index\.php|robots\.txt|upload|resource)(.*)$ /index.php/$1 last;
      }

      #nginx模拟pathinfo,否则CI框架的控制器无法访问
      location ~ \.php(.*)$
      {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param        SCRIPT_FILENAME        $document_root$fastcgi_script_name;
        fastcgi_param        PATH_INFO                $fastcgi_path_info;
        fastcgi_param        PATH_TRANSLATED        $document_root$fastcgi_path_info;
        include        fastcgi_params;
      }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }
    location ~ .*\.(js|css)?$
    {
        expires 1h;
    }

    #伪静态规则
    include /server/nginx/conf/rewrite/**.conf;
    #access_log  /log/nginx/access/***.log;
}

非特殊说明,本博所有文章均为博主原创。

备注:相关侵权、举报、投诉及建议等,请联系站长

添加新评论

昵称
邮箱
网站