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 ...
随机推荐
- XamlParseException异常
一般出现System.Windows.Markup.XamlParseException的错误是由1.dll库加载错误,查询一下你程序中引用的dll你是否加载并引用到程序内.2.程序中引用的文件(tx ...
- bash echo color
原文:https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux $ ; i ...
- cassandra框架模型之二——存储机制 CommitLog MemTable SSTable
四.副本存储 Cassandra不像HBase是基于HDFS的分布式存储,它的数据是存在每个节点的本地文件系统中. Cassandra有三种副本配置策略: 1) SimpleStrategy (Rac ...
- OLED取模笔记
- LeetCode OJ:Reverse Linked List II(反转链表II)
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1-> ...
- Android性能调优实例
本文主要分享自己在appstore项目中的性能调优点,包括同步改异步.缓存.Layout优化.数据库优化.算法优化.延迟执行等. 目前性能优化专题已完成以下部分: 性能优化总纲——性能问题及性能调优方 ...
- springmvc用来绑定参数的注解(转)
引言: 原文链接:http://blog.csdn.net/kobejayandy/article/details/12690161 接上一篇文章,对@RequestMapping进行地址映射讲解之后 ...
- Week03-Java学习笔记第三次作业
Week03-面向对象入门 1.本周学习总结 初学面向对象,会学习到很多碎片化的概念与知识.尝试学会使用思维导图将这些碎片化的概念.知识点组织起来.请使用工具画出本周学习到的知识点及知识点之间的联系. ...
- android自定义view系列:认识activity结构
标签: android 自定义view activity 开发中虽然我们调用Activity的setContentView(R.layout.activity_main)方法显示View视图,但是vi ...
- JAVA视频链接
Java基础Java马士兵:链接:https://pan.baidu.com/s/1jJRvxGi密码:v3xb Java刘意:链接:https://pan.baidu.com/s/1kVZQCqr密 ...