Serving and uploading static files with nginx:
Assuming we have nginx installed in system and our nginx configuration file resides at
create a directory called
data that will store all our images that we wish to serve.
add these in
now if we make a request to
we will get the image file
a.jpg located in
importat part to note above is
root directive. Any request coming as
localhost:9999/images/... matches the above location block,
therefore nginx will strip the part after
localhost:9999/images ( as we have defined
/images/ in location ) and append it after the path defined as root.