Nginx配置PATHINFO隐藏index.php
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的更多相关文章
- 【Nginx】Nginx配置REWRITE隐藏index.php
只需要在server里面加上 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; }
- Nginx配置REWRITE隐藏index.php
server { listen 80; server_name localhost; root D:\workspace\PHP\Atromic; location / { index index.p ...
- TP5框架 nginx服务器 配置域名 隐藏index.php
server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...
- nginx配置pathinfo支持,最佳方案 - chunyu
〇. 前言 pathinfo有两个,1 pathinfo()函数,2 $_SERVER['PATH_INFO'].pathinfo()是php的库函数,原生支持不需要nginx配置,$_SERVER[ ...
- nginx 环境 thinkphp 隐藏index.php
tp官网已经写了 http://doc.thinkphp.cn/manual/hidden_index.html 不生效 重启nginx .问题依旧 kill掉nginx进程 再启动 贴段自己的配置 ...
- 修改Nginx配置文件来隐藏index.php
找到你要修改的域名对应nginx配置文件(vhost下),添加如下代码 location / { if (!-e $request_filename) { rewrite ^(.*)$ /index. ...
- nginx下Thinkphp 隐藏index.php
thinkphp config配置: 'URL_MODEL' => '2', //URL模式 nginx rewrite配置: location / { if (!-e $request_fil ...
- Apache和Nginx配置默认访问index.php
Apache: .htaccess文件配置 Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d R ...
- nginx配置之取消index.php同时不影响js,css功能
server { listen 8084; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; ...
随机推荐
- 《Effective Java》读书笔记八(异常)
No57 只针对异常的情况才使用异常 异常应该只用于异常的情况下,它们永远不应该用于正常的控制流. No58 对可恢复的情况使用受检异常,对编程错误使用运行时异常 Java程序设计语言提供了三种可抛出 ...
- .NET执行SQL插入时间的问题
错误描述: 一个项目,源码是BOSS给的,部署到网上了,运行没有问题,可是在本地运行,就会有问题,问题在于往一些表插入记录的时候,本地不管怎么样都插入不了,而网上就可以插入,都是相同的一份代码 解决: ...
- Zynq7000术语详解,不懂啥是PL,PS,APU,SCU?那就进来看看吧
Zynq7000术语详解,不懂啥是PL,PS,APU,SCU?那就进来看看吧 相信大家刚看到Zynq手册的时候,对着那么一大堆缩略语肯定是一头雾水,特转来一篇文章,为大家解惑 摘要:本文介绍与 ...
- [na]802.1x协议无线认证协议&dot1x有线认证实验
以前搞无线时候,会涉及到无线client接入方式的认证协议. 认证方式+加密方式+有线的dot1x. 注:以前都是doc粘贴到博客的,加上没写博客的习惯,因此会比较乱. EAP(扩展认证协议)是什么? ...
- find 命令查找文件大小为xx的文件
K:字节 G:gb 查找当前目录及子目录下大于1G的文件: # find ./ -size +1G -exec ls -lh {} \; 查找当前目录及子目录下大于1G小于20G的文件: # find ...
- Java – Convert IP address to Decimal Number
In this tutorial, we show you how to convert an IP address to its decimal equivalent in Java, and vi ...
- vue的面包屑导航组件
用来将其放到navbar中: Breadcrumb/index.vue <template> <el-breadcrumb class="app-breadcrumb&qu ...
- oracle中的字符串函数详解
花了点时间 复习.了一下字符串函数 希望对初学者有帮助 ----------连接字符串函数-----------------select concat('leiyi','hubei') from du ...
- 【C++程序员学 python】python 之变量
既然学过C++,那么就应该知道变量是什么,常量是什么. python 相比于C++,在使用变量之前不用先声明. 而是直接使用,python 会根据你的变量自动识别其类型. 假如a = 123 那么a ...
- mysql的onestart和start区别
在FreeBSD上安装了mysql5.7之后,启动mysql时报了如下的错误: root@tuhooo:~ # /usr/local/etc/rc.d/mysql-server start Canno ...