nginx图片资源管理转发

目标:

服务器上面 /home/images 里面作为文件资源管理器 

nginx图片资源管理转发_第1张图片

nginx图片资源管理转发_第2张图片

代码:

    server {
        listen       80;
        server_name  hello.world.cn;
        #apple-app和接口的关联文件
        
        location  ~.*(images/miniapp)*\.(gif|jpg|jpeg|png)$ {
            root /home/;
            try_files $uri $uri/ =404;
            add_header Cache-Control "public, max-age=600";
            expires 10m;
            client_max_body_size 10m;
        } 
    }

nginx图片资源管理转发_第3张图片 

实现访问地址
http:// hello.world.cn/images/miniapp/index_bg.png

你可能感兴趣的:(问题解决,nginx,前端,linux)