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?
仅有的幸福2017-05-24 11:34:50
location ~ .*virtualpath(.*)\.(jpg|png|gif){
root "/home/www";#指定图片存放路径
try_files $uri . last;
}