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的緩存?