【发布时间】:2020-07-10 15:19:11
【问题描述】:
我正在尝试通过 NGINX/uWSGI 配置 PyPi 服务器的缓存,但失败得很惨。
我的/sites-available/pypi 配置如下:
uwsgi_cache_path /mnt/pypi/nginx-cache
levels=1:2
keys_zone=pypiserver_cache:10m
max_size=10g
inactive=60m
use_temp_path=off;
server {
listen 80 default_server;
listen 443 default_server ssl;
ssl_certificate /etc/ssl/certs/domain.pem;
ssl_certificate_key /etc/ssl/private/domain.key;
client_max_body_size 5M;
location / {
uwsgi_cache pypiserver_cache;
uwsgi_buffering on;
uwsgi_cache_key $request_uri;
add_header X-uWSGI-Cache $upstream_cache_status;
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/internal_pypi.socket;
}
}
NGINX 运行并没有报告错误,但多次请求同一个包并不会缓存它(通过 curl URL 并观察标头 X-uWSGI-Cache: MISS 来证明)并且在 /mnt/pypi/nginx-cache 中没有存储任何内容。
如果我能提供更多有用的信息,请告诉我,谢谢!
参考资料:
【问题讨论】: