nginx在用户使用ie的使用重定向到/nginx-MSIE目录下
[root@web01 ]# cat /app/server/nginx/conf/rewrite/default.conf
#rewrite ^/index\.html /index.php last;
#if (!-e $request_filename) rewrite ^/(.*)$ index.php last;
#if (!-e $request_filename) {rewrite ^/(.*)$ /index.php last;}
#if (!-e $request_filename) {return 404;}
if ($http_user_agent ~ Firefox) {rewrite ^(.*)?$ /nginx-Firefox/$ break;}
if ($http_user_agent ~ MSIE) {rewrite ^(.*)$ /nginx-MSIE/$ break;}
#rewrite ^/(\d+)/(.+)/ /$/$ last;
#####################下面的补充说明########################
[root@web01 ]# cat /app/server/nginx/conf/vhosts/default.conf
server {
listen ;
server_name espressos.cn;
index index.php index.htm index.html;
root /app/www/default;
location ~ .*\.(sh|bash)?$
{
return ;
}
# if (!-e $request_filename) {
# rewrite ^/(.*)$ /index.php last;
# }
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
include /app/server/nginx/conf/rewrite/default.conf;
access_log /app/log/nginx/access/default.log;
}
###################################
[root@web01 ]# tree /app/www/default/
/app/www/default/
├── index.php
├── nginx-Firefox
│ └── index.php
├── nginx-MSIE
│ └── index.php
└── ss
└──
└── index.php directories, files
[root@web01 ]# cat /app/www/default/nginx-Firefox/index.php
Firefox
<?php phpinfo();
[root@web01 ]# cat /app/www/default/nginx-MSIE/index.php
MSIE
<?php phpinfo();
[root@web01 ]#


nginx在用户使用ie的使用重定向到/nginx-MSIE目录下的更多相关文章
- Nginx 之四: Nginx服务器的rewrite、全局变量、重定向和防盗链相关功能
一:Nginx 后端服务器组的配置: 1.upstream: 用于设置后端服务器组的主要指令,upstream类似于之前的server块或http块,用法如下: upstreame Myserver{ ...
- Nginx服务器的rewrite、全局变量、重定向和防盗链相关功能
一:Nginx 后端服务器组的配置: 1.upstream: 用于设置后端服务器组的主要指令,upstream类似于之前的server块或http块,用法如下: upstreame Myserver{ ...
- 如何设置让SFTP的用户限制在某个目录下
通常SFTP的任何用户登录之后能看到整个系统的文件目录,这样很不安全. 通过chroot我们可以将某个用户登录SFTP后只能在某个限定的目录下操作,这样可以更安全.我们来看看怎么设置. 1.创建一个用 ...
- Nginx 修改用户权限
[1]Nginx 修改用户权限 (1)修改前:Nginx系统默认用户权限是nobody 查看可知: (2)修改方法 欲使用root权限启动的. 修改 /usr/local/nginx/conf/ 下n ...
- nginx配置用户认证
location ~ .*admin\.php$ { auth_basic "weifenglinux auth"; auth_ba ...
- nginx和Tomcat集成后发生的重定向问题分析和解决
nginx和Tomcat集成后发生的重定向问题分析和解决 Tomcat前端配置一个HTTP服务器应该是大部分应用的标配了,基本思路就是所有动态请求都反向代理给后端的Tomcat,HTTP服务器来处 理 ...
- nginx 添加用户认证
nginx 添加用户认证 nginx 配置文件添加: 配置代理添加用户认证:server { listen ; server_name localhost; location ...
- Nginx网站用户认证
一.Nginx网站用户认证 用户认证:用户访问网页时需要输入一个用户名和密码才能打开网页. nginx的默认网页时安装目录下的html/index.html,配置文件在安装目录下的conf目录中的ng ...
- nginx 配置用户认证
nginx 配置用户认证有两种方式: 1.auth_basic 本机认证,由ngx_http_auth_basic_module模块实现.配置段: http, server, location, li ...
随机推荐
- flush清空输入输出流
#include <string.h> #include <stdio.h> #include <conio.h> #include <io.h> vo ...
- 推荐一份 Google 面试指南
经常有不少读者在我公众号后台留言,说自己还是应届毕业生,缺乏工作经验与项目经验,不知道如何才能通过面试? 其实,项目经验固然重要,但是企业也知道,对于应届毕业生,是很难有拿得出手的项目经验出来的,毕竟 ...
- Python 日期和时间 —— datetime
Python 日期和时间 —— datetime Python提供了多个内置模块用于操作日期时间,如calendar,time,datetime.calendar用于处理日历相关 :time提供的接口 ...
- meterpreter源码
/* by codeliker @2014.12.08 github: https://github.com/codeliker*/ #include <WinSock2.h> ...
- GameObjectPool——Unity中的对象池
这里介绍一种对象池的写法.它的优点在于无论取出还是插入游戏物体都是常数量时间. using UnityEngine; using System.Collections; using System.Co ...
- 分别用Java和JS读取Properties文件内容
项目中经常用到的配置文件,除了XML文件之外,还会用到Properties文件来存储一些信息,例如国际化的设置.jdbc连接信息的配置等.有时候也会把一些路径或者sql语句放到Properties中, ...
- 数据库插入数据返回当前自增主键ID值的方法
当我们插入一条数据的时候,我们很多时候都想立刻获取当前插入的主键值返回以做它用.我们通常的做法有如下几种: 1. 先 select max(id) +1 ,然后将+1后的值作为主键插入数据库: 2. ...
- Java取出String字符串括号中的内容
形如: String idStr="dfda(2018)41324"; private int getId(String gSQL){ String quStr=gSQL.subs ...
- hdu 4983 Goffi and GCD(数论)
题目链接:hdu 4983 Goffi and GCD 题目大意:求有多少对元组满足题目中的公式. 解题思路: n = 1或者k=2时:答案为1 k > 2时:答案为0(n≠1) k = 1时: ...
- Python模块学习 ---- logging 日志记录
许多应用程序中都会有日志模块,用于记录系统在运行过程中的一些关键信息,以便于对系统的运行状况进行跟踪.在.NET平台中,有非常著名的第三方开源日志组件log4net,c++中,有人们熟悉的log4cp ...