Frage

I'm deploying my django app with nginx-uwsgi I wanna add Varnish to this stack. As I know Varnish can cache only ip and port. But my stack configured this way:

location / { 
            uwsgi_pass unix://home/mechanism/SERVER/run/MechanisM.sock; 
            include uwsgi_params;

        } 

so my nginx works with uwsgi's socket. not ip and port. but Varnish needs ip and port. like this:

backend default {
      .host = "127.0.0.1";
      .port = "8080";
}

should I change uwsgi to run with ip and port? or there's some way to configure Varnish to work with uwsgi's sock? or how to know ip and port of this socket?

btw, I'm starting uwsgi with this command:

exec /usr/sbin/uwsgi --socket /home/mechanism/SERVER/run/MechanisM.sock --chmod-socket --module wsgi_app --pythonpath /home/mechanism/SERVER/django-projects/MechanisM/uwsgi -p 12 -t 15

should I use -s 127.0.0.1:3031 instead of --socket /home/mechanism/SERVER/run/MechanisM.sock ??

War es hilfreich?

Lösung

Varnish will cache date coming from nginx, not from uWSGI.

Put the nginx address in varnish not the uWSGI one

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top