zoukankan      html  css  js  c++  java
  • nginx在用户使用ie的使用重定向到/nginx-MSIE目录下

    [root@web01 321]# 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/$1 break;}
    if ($http_user_agent ~ MSIE) {rewrite ^(.*)$ /nginx-MSIE/$1 break;}
    #rewrite ^/(d+)/(.+)/ /$2/$1 last;
    #####################下面的补充说明########################
    [root@web01 321]# cat /app/server/nginx/conf/vhosts/default.conf
    server {
            listen       80;
            server_name  espressos.cn;
        index index.php index.htm index.html;
        root /app/www/default;
        location ~ .*.(sh|bash)?$ 
        {
            return 403;
        }
    #    if (!-e $request_filename) {
    #        rewrite ^/(.*)$ /index.php last;
    #        }
        location ~ .*.(php|php5)?$
        {
            #fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_pass  127.0.0.1:9000;
            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 321]# tree /app/www/default/
    /app/www/default/
    ├── index.php
    ├── nginx-Firefox
    │   └── index.php
    ├── nginx-MSIE
    │   └── index.php
    └── ss
        └── 321
            └── index.php
    
    4 directories, 4 files
    [root@web01 321]# cat /app/www/default/nginx-Firefox/index.php 
    Firefox
    <?php phpinfo();
    [root@web01 321]# cat /app/www/default/nginx-MSIE/index.php 
    MSIE
    <?php phpinfo();
    [root@web01 321]# 

  • 相关阅读:
    rabbitMQ和对应的erlang版本匹配
    Jfinal文件上传基础路径问题,windows下会以项目根路径为基础路径
    Linux常用命令-vim
    nginx配置https
    mysql创建表时,设置timestamp DEFAULT NULL报错1067
    Linux命令yum和rpm
    git reset命令使用
    jfinal定时任务插件jfinal-quartz
    quartz配置参数org.quartz.jobStore.misfireThreshold含义解释
    多层级树形结构数据库存储方式
  • 原文地址:https://www.cnblogs.com/bass6/p/5728061.html
Copyright © 2011-2022 走看看