开发者

help me with config nginx-varnish-uwsgi-django

开发者 https://www.devze.com 2023-02-10 01:22 出处:网络
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.

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/dj开发者_C百科ango-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 ??


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

Put the nginx address in varnish not the uWSGI one

0

精彩评论

暂无评论...
验证码 换一张
取 消