zoukankan      html  css  js  c++  java
  • location 将跟目录下某个文件夹指向2级目录

    例如:

    /caffespressos/指向/web01/caffe/

    [root@web01 default]# tree web01/
    web01/
    └── caffe
        └── index.html
    
    1 directory, 1 file
    [root@web01 default]# cat web01/caffe/index.html 
    rewrite ^/([0-9a-z]+)espressos/(.*)$ /web01/$1/$2 last;
    [root@web01 default]# 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;
    rewrite ^/([0-9a-z]+)espressos/(.*)$ /web01/$1/$2 last;
    [root@web01 default]# /app/server/nginx/sbin/nginx -s reload
    [root@web01 default]# curl http://192.168.1.24/caffeespressos/index.html
    rewrite ^/([0-9a-z]+)espressos/(.*)$ /web01/$1/$2 last;
  • 相关阅读:
    HDU 1058 Humble Numbers
    HDU 1421 搬寝室
    HDU 1176 免费馅饼
    七种排序算法的实现和总结
    算法纲要
    UVa401 回文词
    UVa 10361 Automatic Poetry
    UVa 537 Artificial Intelligence?
    UVa 409 Excuses, Excuses!
    UVa 10878 Decode the tape
  • 原文地址:https://www.cnblogs.com/bass6/p/5728904.html
Copyright © 2011-2022 走看看