This post is about how to start django with nginx (with blocking undesirable bots and with installed base GeoIP).
Detailed installation for: nginx, django, django+fcgi, flup.

Regardless whether django is started in a threaded- or in a fork-mode, FastCGI is used for connection with server, through a socket or through a port.
There are these four versions of script for start, one of which it is necessary to put in the catalogue of your project:
* Threaded+socket
* Threaded+Port
* Fork+socket
* Fork+Port

Now a base configuration file for nginx will be created.
Nginx allows to include configuration from other files, that I have taken advantage of. I have divided into the basic file with the general adjustments, file with parameters for FastCGI, file with addresses of base GeoIP and files for each project/domain.

For GeoIP-module I have used the free version from a site and, which by means of my utility and from a package nginx/contrib converted in acceptable appearance for the web-server.
Example: GB; US; US;
It is possible to download prepared base on the countries at me (gzip 0.6MB). The variable $geo can be used in logs, and also is transferred in the application through FastCGI parameters, in django projects it can be get through request.META['GEO']

In the basic config I have also included speed limit of uploading for different unnecessary search bots and blocking of the some spamers, there it is easy to add or remove something.

Here are all configuration files:
geoip.conf (gzip 0.6MB)
The detailed information about django is here and here. About nginx: here.

21 Votes | Average: 4.5 out of 521 Votes | Average: 4.5 out of 521 Votes | Average: 4.5 out of 521 Votes | Average: 4.5 out of 521 Votes | Average: 4.5 out of 5 (21 votes, average: 4.5 out of 5)
Loading ... Loading ...

Top Posts: