Chinaunix首页 | 论坛 | 博客
  • 博客访问: 724208
  • 博文数量: 225
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2722
  • 用 户 组: 普通用户
  • 注册时间: 2013-02-03 17:32
文章分类

全部博文(225)

文章存档

2019年(7)

2018年(16)

2017年(1)

2016年(26)

2015年(41)

2014年(15)

2013年(119)

我的朋友

分类: PHP

2013-07-12 13:49:33

server {
    listen       88;
    server_name  
    root /www/web/
    index  index.php;
    #过滤文件访问权限
    location ~ ^/(admin|api)\.php$ {
        deny all;
    }
    location / {
        #ThinkPHP Rewrite
        if (!-e $request_filename){
            rewrite ^/(.*)$ /index.php/$1 last;
        }
    }
    location ~ \.php($|/){
        #配置PHP支持PATH_INFO进行URL重写 
        set $script     $uri;
        set $path_info  "";
        if ($uri ~ "^(.+?\.php)(/.+)$") {
            set $script     $1;
            set $path_info  $2;
        }
        fastcgi_pass   127.0.0.1:9000;//如果采用的是php-fpm模式,fastcgi_pass unix:/tmp/php-cgi.sock;
        fastcgi_index  index.php;
        include fcgi.conf;
        fastcgi_param  SCRIPT_FILENAME    $document_root$script;
        fastcgi_param  SCRIPT_NAME        $script;
        fastcgi_param  PATH_INFO          $path_info;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        expires      1d;
    }
    location ~ .*\.(js|css)?$ {
        expires      12h;
    }
}
阅读(1258) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~