i wonder if can help. running vps varnish. vps predominantly wordpress have joomla site running too. reason varnish config file decided going go default have been having range of problems silly enough not save custom config file!
here current config file:
# basic vcl configuration file varnish. see vcl(7) # man page details on vcl syntax , semantics. # # default backend definition. set point content # server. # backend default { .host = "live ip"; .port = "8080"; .max_connections = 800; } acl purge { "localhost"; "127.0.0.1"; } sub vcl_recv { set req.grace = 2m; # set x-forwarded-for header logging in nginx remove req.http.x-forwarded-for; set req.http.x-forwarded-for = client.ip; # remove has_js , cloudflare/google analytics __* cookies , statcounter is_unique set req.http.cookie = regsuball(req.http.cookie, "(^|;\s*)(_[_a-z]+|has_js|is_unique)=[^;]*", ""); # remove ";" prefix, if present. set req.http.cookie = regsub(req.http.cookie, "^;\s*", ""); # either admin pages or login if (req.url ~ "/wp-(login|admin|cron)") { # don't cache, pass backend return (pass); } # remove wp-settings-1 cookie set req.http.cookie = regsuball(req.http.cookie, "wp-settings-1=[^;]+(; )?", ""); # remove wp-settings-time-1 cookie set req.http.cookie = regsuball(req.http.cookie, "wp-settings-time-1=[^;]+(; )?", ""); # remove wp test cookie set req.http.cookie = regsuball(req.http.cookie, "wordpress_test_cookie=[^;]+(;)?", ""); # static content unique theme can cached (so no user uploaded images) # reason don't take wp-content/uploads because of cache size on bigger blogs # fill files getting pushed cache if (req.url ~ "wp-content/themes/" && req.url ~ "\.(css|js|png|gif|jp(e)?g)") { unset req.http.cookie; } # if no cookies present, don't want "uploads" cached due potential size if (req.url ~ "/wp-content/uploads/") { return (pass); } # pages captchas need excluded if (req.url ~ "^/contact/" || req.url ~ "^/links/domains-for-sale/") { return(pass); } # check cookies wordpress-specific items if (req.http.cookie ~ "wordpress_" || req.http.cookie ~ "comment_") { # wordpress specific cookie has been set return (pass); } # allow purge localhost if (req.request == "purge") { if (!client.ip ~ purge) { error 405 "not allowed."; } return (lookup); } # force lookup if request no-cache request client if (req.http.cache-control ~ "no-cache") { return (pass); } # try cache-lookup return (lookup); } sub vcl_fetch { #set obj.grace = 5m; set beresp.grace = 2m; } sub vcl_hit { if (req.request == "purge") { purge; error 200 "purged."; } } sub vcl_miss { if (req.request == "purge") { purge; error 200 "purged."; } }
the issue having wp core files moved subfolder called 'core' , change login url /administrator instead of wp-login.php. login, i'd go either domain.com/administrator or domain.com/core/administrator. if type domain sans /core/ direct */core/administrator.
the way varnish works, doesn't allow me log wp-admin side of site think due cookies. added /administrator vcl-config text didn't seem work.
is able please me out i'd rather not revert installations wp-login.php.
i don't seem able login ssh , purge cache before. can't remember config had before sure missing something, if able improve on code make work best can (or whether have missed important things out entirely, joomla) appreciated.
i don't make theme on fly have users logging various sites hosted on vps add/change posts getting cache purge fantastic i'm beginning pull hair out!
thanks everyone.
to make purge work, can try add vps hostname in "acl purge" section. know had on vps , varnish v4.
and wp admin part, should not caches @ all, try changeing part:
# either admin pages or login if (req.url ~ "/wp-(login|admin|cron)") { # don't cache, pass backend return (pass); }
into this:
# either admin pages or login if (req.url ~ "/core/administrator" || req.url ~ "/administrator") { # don't cache, pass backend return (pass); }
Comments
Post a Comment