By newbie
Hi, i have FastCGI enabled and its working perfectly on my main site. but for my other sites which is in sub directory multisite setup, FastCGI is caching even the admin area too. i dont understand why FasctCGI is not bypassing sub-directory sites admin area when cache bypass is working for main sites admin area. i have opcache enabled as well. is that might be any issue here?
here is the response header from post page
Request URL:http://mysite.com/site2/wp-admin/edit.php
Request Method:GET
Status Code:200 OK
Remote Address:139.162.171.19:80
Referrer Policy:no-referrer-when-downgrade
Cache-Control:no-cache, must-revalidate, max-age=0
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html; charset=UTF-8
Date:Tue, 28 Mar 2017 16:17:56 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Server:nginx/1.10.3
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Cache:HIT
X-Frame-Options:SAMEORIGIN
and these are my FastCGI config
fastcgi_cache_path /var/run/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
add_header X-Cache $upstream_cache_status;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
#Cache everything by default
set $no_cache 0;
#Don't cache POST requests
if ($request_method = POST) {
set $no_cache 1;
}
#Don't cache if the URL contains a query string
if ($query_string != "") {
set $no_cache 1;
}
#Don't cache the following URLs
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
set $no_cache 1;
}
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $no_cache 1;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
# try_files $uri $uri/ /index.html;
# try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_cache MYAPP;
fastcgi_cache_valid 200 60m;
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
}
and this is what i have for enabling multi-site
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
As noted in the other thread, please post the full server block, top to bottom. Feel free to change the domain if you’d like, though make sure everything else is verbatim what you’re using.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.