帮我配置 nginx-varnish-uwsgi-django
我正在使用 nginx-uwsgi 部署我的 django 应用程序 我想将清漆添加到这个堆栈中。 据我所知 Varnish 只能缓存 ip 和端口。 但我的堆栈是这样配置的:
location / {
uwsgi_pass unix://home/mechanism/SERVER/run/MechanisM.sock;
include uwsgi_params;
}
所以我的 nginx 与 uwsgi 的套接字一起工作。不是ip和端口。 但 Varnish 需要 ip 和端口。像这样:
backend default {
.host = "127.0.0.1";
.port = "8080";
}
我应该更改 uwsgi 以使用 ip 和端口运行吗?或者有什么方法可以配置 Varnish 与 uwsgi 的 sock 一起使用?或者如何知道这个套接字的IP和端口?
顺便说一句,我用这个命令启动 uwsgi:
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
我应该使用 -s 127.0.0.1:3031 而不是 --socket /home/mechanism/SERVER/run/MechanisM.sock 吗?
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 ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Varnish 将缓存来自 nginx 的日期,而不是来自 uWSGI 的日期。
将 nginx 地址放入 varnish 中,而不是 uWSGI 中
Varnish will cache date coming from nginx, not from uWSGI.
Put the nginx address in varnish not the uWSGI one