给图片加权限

server{
        listen 9999;
        server_name 192.168.1.187;

        root /www/admin/test;



        location / {
                #伪静态
                #include /www/admin/192.168.1.187_80/wwwroot/.rewrite.conf;

                #首页
                root /www/admin/test;
                index index.php index.html error/index.html;
        }

        #流量限制
        rewrite ^/(.*\.png) http://192.168.1.187:9999/cheng.php?path=$1 permanent;


        #日志
        access_log /www/admin/192.168.1.187_80/log/nginx_access_$logdate.log main;
        error_page  403  /error/403.html;
        error_page  400  /error/400.html;
        error_page  404  /error/404.html;
        error_page  502  /error/502.html;
        error_page  503  /error/503.html;

        #处理PHP
        location  ~ [^/]\.php(/|$) {
                fastcgi_pass 127.0.0.1:7221;
                fastcgi_split_path_info  ^(.+\.php)(.*)$;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO $fastcgi_path_info;
                include fastcgi.conf;
        }


}
<?php
header("content-type:image/jpeg");
#权限认证 echo file_get_contents(
"./{$_GET['path']}");

 

posted @ 2021-12-14 10:30  酷酷的城池  阅读(69)  评论(0编辑  收藏  举报