Mastering Nginx

(Ron) #1

The NGINX HTTP Server


[ 156 ]

uwsgi_param UWSGI_FASTROUTER_KEY $host;
uwsgi_pass emperor;
}

# the robots.txt file is found under the "static" subdirectory
# an exact match speeds up the processing

location = /robots.txt {
root /home/www/sites/$host/static;
access_log off;
}

# again an exact match
location = /favicon.ico {
error_page 404 = @empty;
root /home/www/sites/$host/static;
access_log off;
expires 30d;
}

# generates the empty image referenced above
location @empty {
empty_gif;
}

# if anyone tries to access a '.py' file directly,
# return a File Not Found code
location ~* ^.+\.py$ {
return 404;
}
}
}

This enables multiple sites to be dynamically hosted without changing the
NGINX configuration.

Free download pdf