[英]nginx proxy_cache unable to cache
ı trying content cache with Nginx but not working我尝试使用 Nginx 进行内容缓存但不工作
that is my app.test.conf file那是我的 app.test.conf 文件
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
listen 80;
listen [::]:80;
root /var/www/app.test/html;
index index.php;
server_name app.test;
proxy_cache my_cache;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
finally I was able to solve it, reading started using fastcgi_cache instead of proxy_cache最后我能够解决它,阅读开始使用 fastcgi_cache 而不是 proxy_cache
Of course I added some more things当然我还添加了一些东西
fastcgi_cache my_cache;
fastcgi_cache_valid 200 302 60m;
and result和结果
fastcgi_cache_path /var/cache/nginx/
keys_zone=my_cache:60m
levels=1:2
inactive=3h
max_size=100m;
server {
listen 80;
listen [::]:80;
root /var/www/app.test/html;
index index.php;
server_name app.test;
error_log /var/log/nginx/$host.log;
fastcgi_cache my_cache;
fastcgi_cache_valid 200 302 60m;
fastcgi_cache_valid 404 1m;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.