nginx 配置隐藏index.php效果
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
完整如下
server
{
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name jiqing.dexin.com;
index index.html index.htm index.php admin.php;
root /home/wwwroot/default/dexin/dragon/public;
#error_page 404 /404.html;
include enable-php-pathinfo.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
access_log /home/wwwlogs/access.log;
}
它的功能很简单,如果请求的文件不存在,自动加上index.php。
这样,它既支持index.php/Home/index
。也支持/Home/index
。
nginx 配置隐藏index.php效果的更多相关文章
- nginx配置隐藏index.php
Nginx 服务器隐藏 index.php 配置 location / { try_files $uri $uri/ /index.php?$query_string; } nginx配置中t ...
- Nginx配置 隐藏入口文件index.php
Nginx配置文件里放入这段代码 server { location / { index index.php index.html index.htm l.php; autoindex on; if ...
- Nginx如何隐藏index.html
我要隐藏目录下的index.html,修改Nginux配置如下: 1.修改文档顺序 index index.html index.php 2.开启目录流量 在server或location 段里添加 ...
- Nginx下隐藏index.php
在用NGINX搭建web网站时遇到一个问题,那就是除了网站的首页能够正常打开,其他的子网站都打不开,显示找不到文件.但是如果你在网址后面加上index.php,子网站就又可以打开了.那么我们怎么才能不 ...
- nginx 配置使用index.php作为目录的默认加载文件
配置如下: 在server增加一行: index index.php index.html index.htm default.php default.htm default.html 增加后如下: ...
- nginx 重写 隐藏index.php
修改 nginx.conf 文件location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break ...
- Nginx隐藏index.php和配置vhost
nginx启动命令 启动:nginx停止:nginx -s stop退出:nginx -s quit重启:nginx -s reopen重新加载:nginx -s reload平滑启动:kill -H ...
- nginx 隐藏 index.php 和 开启 pathinfo 模式的配置
nginx 通过 location 的规则匹配将 php 转发给 php-fpm 处理后获取结果然后返回给客户端,转发模式可以通过 unix sock 或 tcp socket 方式.百度了好多文章我 ...
- TP5框架 nginx服务器 配置域名 隐藏index.php
server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...
随机推荐
- Kubernetes源码之旅:从kubectl到API Server
概述: Kubernetes项目目前依然延续着之前爆炸式的扩张.急需能够理解Kubernetes原理并且贡献代码的软件开发者.学习Kubernetes源码并不容易.Kubernetes是使用相对年轻的 ...
- web自动化流程总结
一. 了解需求,什么是系统的核心业务 二. 编写测试用例:用例名称,前置条件,测试数据,测试步骤,期望结果 三. 自动化代码的初步构建:所有的元素定位.元素操作.测试用例都写在一个模块中 问题: 1. ...
- 在阿里云上安装python3.4和pycharm
一. 安装python3.4 二. 安装pycharm 三. 安装可视化界面和远程桌面连接 四. 启动和配置pycharm 五. 安装更多字体 六. 给pycharm设置桌面快捷方式 一. 安装pyt ...
- C#和Java接口对比
C#和java的接口有很多类似之处,对于编程约束和设计模式的实现有重要作用.这里记录几个知识点. 1. C#的接口中不能有字段,但Java的接口中允许有static final修饰的字段/域(fiel ...
- OSI七层模型及应用
应用层:提供访问网络服务的接口.例如telnet. 表示层:提供数据格式转化服务.例如压缩和解压缩. 会话层:提供回话实体的连接服务,进行访问验证和会话管理.例如服务器验证用户登录和断点续传. 传输层 ...
- docker 国内加速器配置
配置镜像加速器 阿里云 登录到 阿里云获取到专属加速地址bqr1dr1n.mirror.aliyuncs.com 找到服务 deamon.js 所在目录C:\ProgramData\docker\co ...
- 使用Jenkins自动编译我的 java 项目 git maven jenkins
之前的项目已经将jenkins部署好,现在添加maven项目 准备工作 安装插件 Git plugin Publish Over SSH 全局设置 key: 是 linux服务器的私钥 Global ...
- PHP获取访问页面HTTP状态码的实现代码
方法一 $header_info=get_headers('//www.jb51.net/'); echo $header_info[0]; //耗时 0.67~0.78 方法二 $ch = curl ...
- http keep - alive 与 长连接
http1.0 2.0 1.1区别 你可以把 WebSocket 看成是 HTTP 协议为了支持长连接所打的一个大补丁,它和 HTTP 有一些共性,是为了解决 HTTP 本身无法解决的某些问题而做出的 ...
- ubuntu与windows共享文件
一.通过vmmare tool工具共享文件 Ubuntu系列10.04.11.04.12.04等虚拟机中安装VMware Tools参考下面两篇文章. http://www.linuxidc.com/ ...