Serving Static Files with NGINX



Setting up NGINX to serve up static files on Dreamcompute
OS: Ubuntu 14.04 Trusty the standard image every dreamcompute account has.

So it’s my understanding the server context is to be nested within the http context and use the server directive to declare an url path and root directive to declare the root path.

So I ended up making /www/data and /www/images directories mainly because these files inside of /www/images/ will be for ebay auctions since they require external links for images in the body of the auctions. keeping a data dir is good too for obvious reasons.

# ./etc/nginx/nginx.conf

http {
    server {
        listen 80;
        location / {
            root /data/www;

        location /images {
            root /data/images/;

sudo nginx -s reload and it’s serving images.

any advice? When Should we use a proxy_pass directive proxy_pass http://localhost:port; inside the server context?

Is it safe to assume if you create another server block with another server_name it will resolve according to the root directive?

So when a client connects NGINX checks each server block?