Welcome! Log In Create A New Profile

Advanced

Looking for jpg resource in other folder with location settings

Posted by kdani 
Looking for jpg resource in other folder with location settings
May 26, 2018 12:44AM
0
down vote
favorite
I have a general nginx rule to serve jpgs from they uri.

so if uri is "http://example.com/images/1.jpg it will server is form the root of the site/images/1.jpg

I want to try and serve the image from alternative path if not found on the original path. how do I write the 2nd location:

here is what I got:

location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|ico)$ {
try_files $uri $uri/ @fallback;
access_log off;
expires max;
log_not_found off;
}
How do I write the fallback to look for the files in another location like /home/user/anotherfodler/ ?

Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 220
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready