`nginx` setup to return files with different file extensions

# Allow .jpeg to be requested with .jpg
location ~ (.+).jpg(.*) {
    try_files $uri $1.jpeg$2 =404;

This will try to find the .jpg first, then see if there’s a matching .jpeg instead; if neither, return a 404.

This article was updated on 2023-01-26

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.