<Thinkphp3.2在windows上配置nginx伪静态
这是一个虚拟站点的配置,访问地址为www.md.net和md.net,指向E:/enterprisecode/md/myanmanews站点目录
只需复制红色部分代码到自己的站点配置中即可,注意红色部分的配置粘贴位置
下面效果实现访问www.test.com/index/index的时候,实际上访问的是www.test.com/index.php/index.php 这样就实现了隐藏index.php和thinkphp3.2的伪静态配置
修改thinkphp3.2的URL模式为2 'URL_MODEL'=> 2// URL模式
配置nginx的站点配置
server {
listen 80;
server_name www.md.net md.net;
root "E:/enterprisecode/md/myanmanews";
location / {
index index.html index.htm index.php;
#autoindex on;
if (!-d $request_filename){
set $rule_0 1$rule_0;
}
if (!-f $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(.*)$ /index.php/$1 last;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.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;
}
}
>