As far as now, i did everything what was written in: The Benefits of Microcaching with NGINX - NGINX
but my Server is still not caching anything. Also no files were written in the proxy_cache_path
This are my configs:
/etc/nginx/nginx.conf
/etc/nginx/conf.d/proxy_cache.conf (self created)
When I call my site I see that nothing is cached, so I checked the proxy_cache_path (/dev/shm/cache/nginx)
Does anyone know whats wrong and what I have to do to make my Plesk (17.5.3, Debian 8.10) working with microcache?
Btw, both Nginx and Apache are running, not just Nginx.
Thanks in advance!
but my Server is still not caching anything. Also no files were written in the proxy_cache_path
This are my configs:
/etc/nginx/nginx.conf
#user nginx;
worker_processes auto;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 2048;
use epoll;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
fastcgi_cache_path /dev/shm/cache/nginx levels=1:2 keys_zone=microcache:2048m inactive=60m;
fastcgi_temp_path /dev/shm/cache/nginx/tmp;
sendfile on;
keepalive_timeout 65;
server_tokens off;
include /etc/nginx/conf.d/*.conf;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
worker_processes auto;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 2048;
use epoll;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
fastcgi_cache_path /dev/shm/cache/nginx levels=1:2 keys_zone=microcache:2048m inactive=60m;
fastcgi_temp_path /dev/shm/cache/nginx/tmp;
sendfile on;
keepalive_timeout 65;
server_tokens off;
include /etc/nginx/conf.d/*.conf;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
/etc/nginx/conf.d/proxy_cache.conf (self created)
server {
listen 173.212.192.253:80;
listen 173.212.192.253:443 ssl http2;
listen [2a02:c207:3002:2709::1]:80;
listen [2a02:c207:3002:2709::1]:443 ssl http2;
location / {
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
fastcgi_cache_lock on;
fastcgi_cache_valid 200 1s;
fastcgi_ignore_headers Cache-Control Expires;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache microcache;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 64k;
fastcgi_busy_buffers_size 1024k;
fastcgi_temp_file_write_size 512k;
fastcgi_read_timeout 2m;
fastcgi_buffering on;
}
set $nocache "";
if ($http_cookie ~ (nice_one)) {
set $nocache "true";
}
if ($request_method ~ ^(HEAD|POST)$) {
set $nocache "true";
}
if ($uri ~ (captcha.php)) {
set $nocache "true";
}
if ($uri ~ (admincp)) {
set $nocache "true";
}
}
listen 173.212.192.253:80;
listen 173.212.192.253:443 ssl http2;
listen [2a02:c207:3002:2709::1]:80;
listen [2a02:c207:3002:2709::1]:443 ssl http2;
location / {
add_header X-Cache-Status $upstream_cache_status;
add_header Cache-Control "public";
fastcgi_cache_lock on;
fastcgi_cache_valid 200 1s;
fastcgi_ignore_headers Cache-Control Expires;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache microcache;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 64k;
fastcgi_busy_buffers_size 1024k;
fastcgi_temp_file_write_size 512k;
fastcgi_read_timeout 2m;
fastcgi_buffering on;
}
set $nocache "";
if ($http_cookie ~ (nice_one)) {
set $nocache "true";
}
if ($request_method ~ ^(HEAD|POST)$) {
set $nocache "true";
}
if ($uri ~ (captcha.php)) {
set $nocache "true";
}
if ($uri ~ (admincp)) {
set $nocache "true";
}
}
When I call my site I see that nothing is cached, so I checked the proxy_cache_path (/dev/shm/cache/nginx)
ls -l /dev/shm/cache/nginx
total 0
drwxr-xr-x 2 nginx root tmp
ls -l /dev/shm/cache/nginx/tmp/
total 0
total 0
drwxr-xr-x 2 nginx root tmp
ls -l /dev/shm/cache/nginx/tmp/
total 0
Does anyone know whats wrong and what I have to do to make my Plesk (17.5.3, Debian 8.10) working with microcache?
Btw, both Nginx and Apache are running, not just Nginx.
Thanks in advance!