zoukankan      html  css  js  c++  java
  • location 禁止多目录

    [root@web01 default]# mkdir cron templates
    [root@web01 default]# tree
    .
    ├── cron
    └── templates
    
    2 directories, 0 files
    [root@web01 default]# tree 
    .
    ├── cron
    │   └── index.html
    └── templates
        └── index.html
    
    2 directories, 2 files
    [root@web01 default]# cat cron/index.html 
    i am cron
    [root@web01 default]# cat templates/index.html 
    i am templates
    [root@web01 default]# 
    [root@web01 templates]# curl http://192.168.1.24/cron/
    i am cron
    [root@web01 templates]# curl http://192.168.1.24/templates/
    i am templates
    [root@web01 templates]# 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;
    location ~ ^/(cron|templates)/ {deny all;break;}
    [root@web01 templates]# curl http://192.168.1.24/cron/
    <html>
    <head><title>403 Forbidden</title></head>
    <body bgcolor="white">
    <center><h1>403 Forbidden</h1></center>
    <hr><center>nginx/1.4.4</center>
    </body>
    </html>
    [root@web01 templates]# curl http://192.168.1.24/templates/
    <html>
    <head><title>403 Forbidden</title></head>
    <body bgcolor="white">
    <center><h1>403 Forbidden</h1></center>
    <hr><center>nginx/1.4.4</center>
    </body>
    </html>
  • 相关阅读:
    uva 1391(2-SAT)
    uva 1146(2-SAT+二分判断)
    uva 12167(强连通分支)
    uva 11324(强连通分支+DAG)
    Codeforces Round #227 (Div. 2) 解题报告
    uva 10319(2-SAT)
    uva 610(割边)
    uva 11504(强连通分支)
    测试:网页测试,入门面试题
    测试:安装包的测试
  • 原文地址:https://www.cnblogs.com/bass6/p/5728174.html
Copyright © 2011-2022 走看看