Nginx as Reverse Proxy Cache of fcgi django app in separate server

Alvaro Mantilla Gimenez alvaro at eragoo.com
Fri Apr 26 18:40:06 UTC 2013


Hi,

   I've been looking on Internet about this but seems all the examples
available are for a proxy conf or fcgi conf. Not both.

   This is my scenario: I have three servers. The first one run only nginx
(and it should be the entry point for my websites) and the other two
servers run django apps.

   Those django apps have been launched as fastcgi applications and listen
on some ports. For example:

          /usr/bin/python /var/www/app/manage.py runfcgi method=threaded
host=server_ip port=1111

   My intention is to run nginx as a reverse proxy for caching some pages
(created through django templates). I set the nginx configuration on this
way:

    upstream app {
    ip_hash;
    server server_ip1:1111;
    server server_ip2:1111;
    }

    location / {
        include fastcgi_params;
        fastcgi_pass app;
        fastcgi_split_path_info ^()(.*)$;

    }

    This way the application works (however I am not sure if I am reaching
both servers). But, If I change the configuration to this:

     location / {
         proxy_pass http://app;
   }

   Then nginx shows an error and I can't see the django app.

   Any idea?

   Thanks in advance!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130426/aed8b32b/attachment.html>


More information about the nginx mailing list