Problems with nginx handling static resources
给我你的怀抱
给我你的怀抱 2017-05-24 11:32:50
0
1
700

I have such a request URL http://example.com/virtualpat..., all requests start from virtualpath, the actual directory corresponding to avatar.png is /home/www/static /avatar.jpg, how to let nginx process this static file directly? When I set root /home/www, the final directory nginx accesses is /home/www/virtualpath/static/avatar .jpg, then it will be 404. How to configure nginx for such a problem?

给我你的怀抱
给我你的怀抱

reply all(1)
仅有的幸福
    location ~ .*virtualpath(.*)\.(jpg|png|gif){
        root "/home/www";#指定图片存放路径
        try_files $uri . last;
    }
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template