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; ...
随机推荐
- mysqld_safe与mysqld区别详解
mysqld_safe与mysqld区别,直接运行mysqld程序来启动MySQL服务的方法很少见,mysqld_safe脚本会在启动MySQL服务器后继续监控其运行情况,并在其死机时重新启动它. 用 ...
- Oracle学习笔记之三,Oracle 11g数据库的启动与关闭
SQL*PLus命令 SQLPLUS username[/password][@connect_identifier][AS SYSOPER|SYSDAB] 1. 启动数据库实例 STARTUP [n ...
- Socket tips: 同意socket发送UDP Broadcast
假设创建一个UDP Socket: socketHandle = socket(serverAddr->ai_family, serverAddr->ai_socktype, server ...
- js获取当前页面url网址等信息
使用js获取当前页面的url网址信息. 1.设置或获取整个 URL 为字符串: window.location.href 2.设置或获取与 URL 关联的端口号码: window.location.p ...
- [na]诺顿ghost磁盘对刻(备份系统分区或数据分区)
一 诺顿ghost简介 ,可以克隆分区 也可以克隆磁盘 ,克隆成img或磁盘内容对刻 ,磁盘分区--img---磁盘分区 磁盘---磁盘 二 操作步骤 对刻好的系统 整体思路: ,A是模板机,A有C ...
- Django2.1更新日志
前两天本来想把2.1的release note做个中文摘要,后来发现没什么大的改动. 不过更新以后还是发下一个bug,或者是已经feature本身的改动,就是QueryDict这个类的实例不能再往里放 ...
- win64位操作系统下安装pl/sql developer 并登录连接到oracle12c
1)安装Oracle 12c 64位2)安装32位的Oracle客户端( instantclient-basic-nt-12.1.0.1.0)下载instantclient-basic-nt-12.1 ...
- CString转char * ,string
CString头文件#include <afx.h> string头文件#include <string.h> 1.CString转char * CString cstr; c ...
- Docker学习总结之Docker与Vagrant之间的特点比较
以下内容均出自Vagrant作者(Mitchell Hashimoto)与Docker作者(Solomon Hykes)在stackoverflow上面一个问题讨论.在这个问题中,双方阐述了vagra ...
- 双系统中ubuntu的安装方法
双系统中ubuntu的安装方法 注意:给电脑安装双系统时,一定要先装Windows系统,再安装Linux系统! 原因是电脑开机后,要先执行一段bootloader引导程序:再由引导程序启动操作系统.W ...