zoukankan      html  css  js  c++  java
  • location 将多级目录下的文件转成一个文件

      /ck-135-201-7142.html 指向/ck/135/201/7142.html

    [root@web01 www]# 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?id=$1 last;
    #location ~ ^/(cron|templates)/ {deny all;break;}
    #location ~ ^/data {deny all;}
    #location ^~ /html/m.js {access_log off;root /app/www;expires 5;break;}
    rewrite ^/ck-([0-9]+)-([0-9]+)-([0-9]+).html$ /ck/$1/$2/$3.html last;
    [root@web01 www]# tree default/ck/
    default/ck/
    └── 135
        └── 201
            └── 7142.html
    
    2 directories, 1 file
    [root@web01 www]# cat default/ck/135/201/7142.html 
    bass clnking@163.com
    [root@web01 www]# curl http://192.168.1.24/ck-135-201-7142.html
    bass clnking@163.com
  • 相关阅读:
    BOM:浏览器对象模型
    webStorm 用git上传代码(github)
    flex弹性布局
    面试题(一)
    HTTP协议···(一)
    构造函数
    断点调试
    FCC 高级算法题 库存更新
    FCC 高级算法题 收银机找零钱
    FCC 高级算法题 对称差分
  • 原文地址:https://www.cnblogs.com/bass6/p/5728812.html
Copyright © 2011-2022 走看看