Control Web Panel

WebPanel => Apache => Varnish => Topic started by: blackstar on September 22, 2017, 11:35:18 AM

Title: Wordpress robust default.vcl ? do you have any?
Post by: blackstar 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..
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: studio4host 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
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: blackstar 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?
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: GTMAN on November 29, 2018, 05:38:57 PM
Free copy of my VCL

https://gtmanagement.com/plugins (https://gtmanagement.com/plugins)
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: tokar86a on March 03, 2019, 06:37:48 PM
Free copy of my VCL

https://gtmanagement.com/plugins (https://gtmanagement.com/plugins)

The link dont work.
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: blackstar on March 14, 2019, 01:15:31 AM
Free copy of my VCL

https://gtmanagement.com/plugins (https://gtmanagement.com/plugins)

I could not reach the file. Would you please install it somewhere else?
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: GTMAN 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);
}
Title: Re: Wordpress robust default.vcl ? do you have any?
Post by: overseer 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.