我有一个Nginx服务器设置,启用了fastcgi_cache,但根本没有任何缓存。缓存文件夹为空。我已经尝试过几次重建nginx而没有任何成功。这可能与我在子目录中的$ args为空的其他问题有关,请参阅此处:https://stackoverflow.com/posts/36349729
Nginx构建于:
implicit val convertRes = Json.writes[U]
nginx.conf
--sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log
--http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module
--with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-ipv6 --with-http_realip_module
服务器conf:
#user nobody;
worker_processes 2;
pid /var/log/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/web.access.log main;
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:250m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
client_max_body_size 200M;
# If your domain names are long, increase this parameter.
server_names_hash_bucket_size 64;
include /etc/nginx/sites-available/*.conf;
}