nginx配置ThinkPHP Rewrite
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
server
listen
#过滤文件访问权限
location
deny
}
location
#ThinkPHP
if
(!-e
rewrite
/index
.php/$1
}
}
location
#配置PHP支持PATH_INFO进行URL重写
set
$script
set
$path_info
""
;
if
($uri
"^(.+?\.php)(/.+)$"
)
set
$script
set
$path_info
}
fastcgi_pass
fastcgi_index
include /alidata/server/nginx/conf/fastcgi_params;
fastcgi_param
fastcgi_param
fastcgi_param
}
location
expires
}
location
expires
}
}
|
在ThinkPHP入口文件中加入下面的代码
//解决nginx下访问
define('_PHP_FILE_',$_SERVER['SCRIPT_NAME']);