Author Topic: Wordpress robust default.vcl ? do you have any?  (Read 13393 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Wordpress robust default.vcl ? do you have any?
« on: September 22, 2017, 11:35:18 AM »
Hi, I'm using apache + nginx proxy + varnish. but varnish is not enough. Do you have a default default.vcl file that will reduce the load? Or who can write for a fee? payment method paxum.

note: varnish 4 vcl..

Offline
*
Re: Wordpress robust default.vcl ? do you have any?
« Reply #1 on: September 22, 2017, 01:03:13 PM »
you need to check varnish configuration based on your script/cms, example for wordpress
you would google varnish configuration for wordpress
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: Wordpress robust default.vcl ? do you have any?
« Reply #2 on: September 22, 2017, 02:40:44 PM »
you need to check varnish configuration based on your script/cms, example for wordpress
you would google varnish configuration for wordpress

Thank you very much, but I could not find anything suitable. Maybe your expert friends have it?

Offline
**
Re: Wordpress robust default.vcl ? do you have any?
« Reply #3 on: November 29, 2018, 05:38:57 PM »

Offline
*

Offline
*
Re: Wordpress robust default.vcl ? do you have any?
« Reply #5 on: March 14, 2019, 01:15:31 AM »
Free copy of my VCL

https://gtmanagement.com/plugins

I could not reach the file. Would you please install it somewhere else?

Offline
**
Re: Wordpress robust default.vcl ? do you have any?
« Reply #6 on: March 14, 2019, 05:24:06 PM »
/usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/varnish/wordpress.tpl


Code: [Select]
backend %backend_domain% {
.host = "%proxy_ip%";
.port = "%proxy_port%";
}

sub vcl_recv {
if (req.http.host ~ "%domain%") {
   set req.backend_hint = %backend_domain%;
}

# Always cache the following file types for all users.
if (req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js|html|htm)(\?[a-z0-9]+)?$") {
unset req.http.Cookie;
}

# Remove any Google Analytics based cookies
set req.http.Cookie = regsuball(req.http.Cookie, "has_js=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "_ga=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "utmctr=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "utmcmd.=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "utmccn.=[^;]+(; )?", "");

# Do not cache AJAX requests.
if (req.http.X-Requested-With == "XMLHttpRequest") {
return(pass);
}

# Post requests will not be cached
if (req.http.Authorization || req.method == "POST") {
return (pass);
}
if (req.method != "GET" && req.method != "HEAD") {
return (pass);
}

# Do not cache Authorized requests.
if (req.http.Authorization) {
return(pass);
}

# LetsEncrypt Certbot passthrough
if (req.url ~ "^/\.well-known/acme-challenge/") {
return (pass);
}

# Forward client's IP to the backend
if (req.restarts == 0) {
if (req.http.X-Real-IP) {
set req.http.X-Forwarded-For = req.http.X-Real-IP;
} else if (req.http.X-Forwarded-For) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
}

### Wordpress ###
if (req.url ~ "(wp-admin|post\.php|edit\.php|wp-login)") {
return(pass);
}
if (req.url ~ "/wp-cron.php" || req.url ~ "preview=true") {
return (pass);
}

# WP-Affiliate
if ( req.url ~ "\?ref=" ) {
return (pass);
}

set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-1=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-time-1=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_test_cookie=[^;]+(; )?", "");
set req.http.Cookie = regsuball(req.http.Cookie, "PHPSESSID=[^;]+(; )?", "");

return (hash);
}

Offline
*****
Re: Wordpress robust default.vcl ? do you have any?
« Reply #7 on: January 08, 2023, 09:03:01 PM »
Thanks much! I have WordPress sites running under nginx but have had thoughts of integrating Varnish into the flow to milk a little more performance out of the site, esp. since it is more static in nature. I'll give your .vcl a test drive and see how it goes. I'll report back if I have any issues.