首页 > Web开发 > 详细

nginx 环境 thinkphp 隐藏index.php

时间:2017-10-16 17:41:44      阅读:251      评论:0      收藏:0      [点我收藏+]

tp官网已经写了 http://doc.thinkphp.cn/manual/hidden_index.html

 

不生效 重启nginx .问题依旧

kill掉nginx进程  再启动

贴段自己的配置:

server {
listen 80;
server_name url;
root /*/*/*;

#include conf.d/ipFilter.conf;
#access_log /data/logs/$server_name.access.log main;

if ($http_user_agent ~ "DNSPod") {

return 200;

}

try_files $uri $uri/ @rewrite;

#隐藏index.php

location / {

       if (!-e $request_filename) {

               rewrite ^(.*)$ /index.php?s=$1 last;
              break;

#pathinfo模式

location ~ \.php {

fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;

fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

}

 

nginx 环境 thinkphp 隐藏index.php

原文:http://www.cnblogs.com/xiaommvik/p/7677668.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!