I'm developing an Avatar storage & display module for my site.
In my design, I store user's avatar as a file on HDD, and name it based on user id. For example, user with uid=100 has an avatar in following path: /data/avatars/100.ava.
I allow users to upload .jpg, .png, .gif images for their avatar. After users uploaded avatar, my server will crop & resize it to 200x200px, and rename file to .ava.
For displaying, I find out that there is a difference between Apache httpd and Nginx.
For Apache httpd: I config a virtual host called avatar.mysite.com, and point root directory to /data/avatars. When I use Chrome browser to visit http://avatar.mysite.com/100.ava, the browser display avatar correctly, with proper Content-type header in response (I tried .gif, .jpg & .png, all are ok)
For nginx: I config a virtual host called avatar.mysite.com, and point root directory to /data/avatars, too. But when I visit http://avatar.mysite.com/100.ava, the browser downloads file 100.ava (instead of displays it). As I checked, the content-type for .ava always be application/octet-stream
So, how could I config nginx to response correct content-type in this sistuation?
Thank you in advanced!