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;
}
}
阅读(1310) | 评论(0) | 转发(0) |