Copying from meta-wiki thread:
On my wiki I am allowing to link to image files from Commons and from some Wikipedias. I noticed however that I was having trouble with images whose extension was in all caps, such as ".JPG".
I finally found the fix, it was in my nginx setup where I had to add capitalized versions of file extensions to the list of static files to be served directly by nginx (in Plesk, there is a "Serve static files directly by nginx" option with a list of file extensions, I simply copy - pasted the list with another capitalized version of the list, after which image files with "JPG" extensions were finally served correctly).