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

最新文章

  1. mysql优化笔记之分页
  2. Compute Resource Consolidation Pattern 计算资源整合模式
  3. The Amazing ProgressBar Control(转)
  4. Windows 服务器使用FTP出现“当前的安全设置不允许从该位置下载文件" 警告
  5. BZOJ2708 [Violet 1]木偶
  6. 《OD学hadoop》第三周0710
  7. 使用ajax()方法加载服务器数据
  8. ArrayList和List之间的转换
  9. Php 魔术常量
  10. Install MongoDB on Windows (Windows下安装MongoDB)
  11. 实现StatusBar的Flat风格
  12. Cocos2d-x在线粒子编辑器
  13. set, list 和map知识总结
  14. 201521123007《Java程序设计》第11周学习总结
  15. JAVA入门[19]-Hibernate简单示例
  16. HAProxy出现"远程主机强迫关闭了一个现有的连接 " 的错误及解决
  17. 经典的GDB调试命令
  18. jenkins借助winscp传本地文件到远程服务器上
  19. Java8新特性值Lambda --->匿名函数
  20. 5_Python OOP

热门文章

  1. 教你如何写thinkphp多表查询语句
  2. 【RapidIO相关】DSP与FPGA通信
  3. 对于火狐浏览器中title不能换行自动变成...怎么解决的?
  4. jQery的方法
  5. js事件委托及其原理
  6. 国际化的工具类ognl utils
  7. Python 并行分布式框架 Celery
  8. C++使用ocilib访问oracle数据库
  9. BAT-使用BAT方法清理Delphi临时文件
  10. 【C#】复制物体后,给副本命名的规则——用正则表达式