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. Spring的三种注入方式(Setter、构造函数和自动注入)

    一.Setter注入 这里我是希望在Student.java中调用Course.java中的内容. public class Course { public String name = "数 ...

  2. Maven pom.xml 报 Missing artifact jdk.tools:jdk.tools:jar:1.7

    linux中用eclipse 新建maven project,pom.xml中报Missing artifact jdk.tools:jdk.tools:jar:1.7 解决方法: 在pom.xml中 ...

  3. 【转】js frame 框架编程

    源地址:http://www.blogjava.net/lusm/archive/2008/02/11/179620.html 1 框架编程概述 一个Html 页面可以有一个或多个子框架,这些子框架以 ...

  4. vi作者:Bill Joy

    威廉·纳尔逊·乔伊(William Nelson Joy,1954年11月8日-),通称比尔·乔伊(Bill Joy),美国计算机科学家.与Vinod Khosla.Scott McNealy和And ...

  5. DMA&PIO

    DMA&PIO   DMA的英文拼写是“Direct Memory Access”,汉语的意思就是直接内存访问,是一种不经过CPU而直接从内存存取数据的数据交换模式.在DMA模式下,CPU只须 ...

  6. INTEL

    http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html http ...

  7. 十倍交叉验证 10-fold cross-validation

          10-fold cross-validation,用来测试算法准确性.是常用的测试方法.将数据集分成十份,轮流将其中9份作为训练数据,1份作为测试数据,进行试验.每次试验都会得出相应的正确 ...

  8. How To Install and Configure Elasticsearch on Ubuntu 14.04

    Reference: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsear ...

  9. jackson2.1.4 序列化 通过给定Class映射 与抽象类的映射

    //如果已知想要序列化的类型 可以使用TypeReference来进行处理 //List<MyBean> result = mapper.readValue(src, new TypeRe ...

  10. 单片机小白学步系列(二十) IO口原理

    IO口操作是单片机实践中最基本最重要的一个知识,本篇花了比較长的篇幅介绍IO口的原理. 也是查阅了不少资料,确保内容正确无误,花了非常长时间写的. IO口原理原本须要涉及非常多深入的知识,而这里尽最大 ...