i’m using wordpress, and i need web page accelerator.
I have SSL and i’ve decided to install Varnish.
Configurations looks like that
Request -> Apache (:443) -> Varnish (:80) -> Apache (:8080).
All works fine, page display correctly, my header is:
Accept-Ranges bytes
Age 0
Connection Keep-Alive
Content-Encoding gzip
Content-Length 19699
Content-Type text/html; charset=UTF-8
Date Thu, 29 Nov 2018 21:11:24 GMT
Keep-Alive timeout=5, max=100
Link <https://.../>; rel="https://api.w.org/"
Link
<https://test.manufakturakawy.com/?p=1>; rel=shortlink
Server Apache/2.4.18 (Ubuntu)
Vary Accept-Encoding
Via 1.1 varnish-v4
X-Pingback https://..../xmlrpc.php
X-Varnish 33072
The issue is, that “Age” is 0.
I’ve installed [plugin][1] which say:
Cache Service Varnish caching service is running but is unable to cache your site.
Default.vcl file is almost standard:
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
# Happens before we check if we have this in cache already.
#
# Typically you clean up the request here, removing cookies you don't need,
# rewriting the request, etc.
}
sub vcl_backend_response {
# Happens after we have read the response headers from the backend.
#
# Here you clean the response headers, removing silly Set-Cookie headers
# and other mistakes your backend does.
if (beresp.ttl == 120s) {
set beresp.ttl = 1h;
}
}
sub vcl_deliver {
# Happens when we have all the pieces we need, and are about to send the
# response to the client.
#
# You can do accounting or modifying the final object here.
}
[1]: https://wordpress.org/plugins/varnish-http-purge/
Could you support me, what i missed?
2
Answers
I’m setting it OK for https://example.com, but http://example.com doesn’t redirect to https://example.com
Apache version 2.4.6 on CentOS 7
Apache listen port 8080
Varnish version 5.2
You can read detail form
https://bash-prompt.net/guides/apache-varnish/
This update will redirect http://example.com to https://example.com