1.网络来源:http://www.shouce.ren/post/view/id/1529

server { 

    listen       80;

    default_type text/plain;

    root /var/www/html;

    index index.php index.htm index.html;

#隐藏index.php

    location / {

          if (!-e $request_filename) {

                   #一级目录

                  # rewrite ^/(.*)$ /index.php/$1 last;

                   #二级目录

                   rewrite ^/MYAPP/(.*)$ /MYAPP/index.php/$1 last;

             }  

    }

#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;

        }

}

2.实际项目中的,我的做法(我的项目全在:application/home 下)

location / {
index index.htm index.html index.php;
try_files $uri /index.php$uri; if (!-e $request_filename) {
#一级目录
rewrite ^/(.*)$ /index.php/$1 last;
#二级目录
rewrite ^/./(.*)$ /MYAPP/index.php/$1 last;
}
}

Nginx配置PATHINFO隐藏index.php的更多相关文章

  1. 【Nginx】Nginx配置REWRITE隐藏index.php

    只需要在server里面加上 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; }

  2. Nginx配置REWRITE隐藏index.php

    server { listen 80; server_name localhost; root D:\workspace\PHP\Atromic; location / { index index.p ...

  3. TP5框架 nginx服务器 配置域名 隐藏index.php

    server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...

  4. nginx配置pathinfo支持,最佳方案 - chunyu

    〇. 前言 pathinfo有两个,1 pathinfo()函数,2 $_SERVER['PATH_INFO'].pathinfo()是php的库函数,原生支持不需要nginx配置,$_SERVER[ ...

  5. nginx 环境 thinkphp 隐藏index.php

    tp官网已经写了 http://doc.thinkphp.cn/manual/hidden_index.html 不生效 重启nginx .问题依旧 kill掉nginx进程  再启动 贴段自己的配置 ...

  6. 修改Nginx配置文件来隐藏index.php

    找到你要修改的域名对应nginx配置文件(vhost下),添加如下代码 location / { if (!-e $request_filename) { rewrite ^(.*)$ /index. ...

  7. nginx下Thinkphp 隐藏index.php

    thinkphp config配置: 'URL_MODEL' => '2', //URL模式 nginx rewrite配置: location / { if (!-e $request_fil ...

  8. Apache和Nginx配置默认访问index.php

    Apache: .htaccess文件配置 Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d R ...

  9. nginx配置之取消index.php同时不影响js,css功能

    server { listen 8084; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; ...

随机推荐

  1. Qt中使用DOM解析XML文件或者字符串二(实例)

    介绍 在Qt中提供了QtXml模块实现了对XML数据的处理,我们在Qt帮助中输入关键字QtXml Module,可以看到该模块的类表.在这里我们可以看到所有相关的类,它们主要是服务于两种操作XML文档 ...

  2. Lerp和SmoothDamp比较

    Lerp更像是线性衰减,而SmoothDamp像是弧形衰减,两者都是由快而慢 其中SmoothDamp多用于相机跟随.但如果其他类型的插值,我个人觉的其实都差不多 SmoothDamp: transf ...

  3. ISE设置默认引脚 ,上拉或下拉或三态

    quartus可以在Devic and Pin Options里设置默认引脚状态, ISE也有这个功能,步骤如下, 1.右击Generate Programming File 2.选择Process ...

  4. IServerChannelSinkProvider

    (一) Remoting框架图 这是msdn上关于Remoting客户端与服务器端进行通信的示意图.客户端与服务端的通信是通过发送消息来实现的.消息的处理是由客户端,服务端创建的一系列的通信信道来处理 ...

  5. zabbix监控某个普通端口

    linux下端口和服务是对应的. 先创建一个模板:configureation-->templates然后点create templates按钮: 如果没有组可以新建个组:app 查看新建的te ...

  6. Facebook提出DensePose数据集和网络架构:可实现实时的人体姿态估计

    https://baijiahao.baidu.com/s?id=1591987712899539583 选自arXiv 作者:Rza Alp Güler, Natalia Neverova, Ias ...

  7. Oracle数据库操作类及连接方法

    创建DataBaseAccess引用库下面包括DBConnectionString.cs,DBType.cs ,SysName.cs 三个类 DBConnectionString: using Sys ...

  8. 在VC中向数据库提交SLQ语句

    1.通过链接对象执行SQL语句 mfc没有提供对ado的操作类,它对ado的操作是通过智能指针来完成,要创建ado连接对象,需要像下面代码一样先定义一个连接对象的智能指针: _ConnectionPt ...

  9. 【Maven学习】Maven打包生成包含所有依赖的jar包

    http://blog.csdn.net/u013177446/article/details/54134583 ******************************************* ...

  10. 将ip地址转换成C段地址的UDF

    将ip地址转换成C段地址的UDF,最重要的是判断IP地址的正则表达式. package cn.cnnic.ops.Study; import java.util.regex.Pattern; impo ...