0
在RHEL服务器上,有一段时间让我的nginx配置为缓存的WP站点提供服务。我想在nginx层处理缓存,而不是用WP插件解决问题,因为我认为它会更可靠(可能使用nginx缓存清除插件只是为了帮助WP处理清除)。还没有找到实际上在缓存中返回HIT的配置设置的组合。下面的配置 - 希望你们都能看到我缺少的东西(我已经删除了所有的缓存配置,因为它们都没有工作 - 这基本上是从nginx站点直接获取标准WP设置):带缓存的nginx WordPress配置
add_header Fastcgi-Cache $upstream_cache_status;
# Upstream to abstract backend connection(s) for php
upstream php {
server unix:/tmp/php-cgi.socket;
server 127.0.0.1:9000;
}
server {
listen 80;
listen [::]:80;
listen 443 ssl;
## Your website name goes here.
server_name intranet-test.*;
root /var/www/html/intranet;
index index.php index.html index.htm;
ssl_certificate /etc/httpd/conf.d/certificates/intranet-test.cer;
ssl_certificate_key /etc/httpd/conf.d/keys/intranet-test.key;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location/{
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
需要添加什么来设置nginx的缓存?