• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question WordPress Cache Problem

bmalkoc

Basic Pleskian
Hello. I tried all popular cache plugins but WordPress cache doesn't work in nginx. I think it is related to nginx configuration. I am using this code (found in plesk website). Is that correct? Or what can i do for fix this?

Code:
# WORDPRESS PERMALINKS
if (!-e $request_filename) {
    rewrite ^(.+)$ /index.php?q=$1 last;
}

# GZIP Compression
gzip on;
gzip_disable "MSIE [1-6]\\.(?!.*SV1)";
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_proxied any;
gzip_comp_level 9;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;

# NGINX Caching
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff)$ {
    expires 30d;
    add_header Cache-Control "public";
    log_not_found off;
}

location ~* \.(jpg|jpeg|gif|png)$ {
    expires 365d;
    log_not_found off;
}

location ~* \.(pdf|css|html|js|swf)$ {
    expires 2d;
    log_not_found off;
}

location ~ \.css {
    add_header  Content-Type    text/css;
}
location ~ \.js {
    add_header  Content-Type    application/x-javascript;
}

# SECURITY
location ~* wp-config.php { deny all; }
location ~* "^/wp-content/(?!plugins/).*\.php" { deny all; }
 
Hi,
where have you found the config above?
You can try removing the #SECURITY-Part at the bottom, maybe this is blocking the access.
Have you disabled the "Proxy mode"?
 
Hi,
where have you found the config above?
You can try removing the #SECURITY-Part at the bottom, maybe this is blocking the access.
Have you disabled the "Proxy mode"?
Hello thanks for your reply. I don't remember where i found. I deleted security section but doesn't work. Also proxy mode is disabled.
 
Alright, which caching plugin are you using?
I would try removing the whole #NGINX Caching section and let it handle with the wp caching plugin.
 
For me, wp rocket is working fine (disabled proxy mode, no nginx caching, no serving of static files by nginx).
Which php handler are you using?
 
I've no additional nginx settings configured which would affect anything like that.
How do you check if the files are cached or not?
 
Your "Additional nginx directives" empty right?

I am checking cache from source code. There is must be "<!-- This website is like a Rocket, isn't it? Performance optimized by WP Rocket." text. And scripts not minified and combined.
 
Are you using cloudflare or something else that might be caching the website before your wp rocket installation?
 
Back
Top