These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Installed Varnish, now every website redirects to main site on the new forum.
Hi guys, i wanted to install varnish on vhost sites. I followed this guide: http://virtualmin.com/documentation/system/varnish For some reason i can only go to my main site. All other sites get redirected to main site. How can i fix this?thanks
Are you sure varnish is listening on port 80?
Check in your headers if you see the 'Age' header, otherwise your sites may actually be served by apache which may serve the default as it may not have any vhosts anymore for port 80 (as that was changed to 8080).
Hi, i checked header. The age is 0.
The problem is that the etc/default/varnish file opens in notepad. This is the change Alternative 2, Configuration with VCL #
Listen on port 6081, administration on localhost:6082, and forward to one content server selected by the vcl file, based on the request. Use a 1GB fixed-size cache file.# DAEMON_OPTS="-a :80 \ <-- i was 6081 -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,1024m"
#I got some sites working now. I have changed the ports from 80 to 8080 in /etc/apache2/sites-available where the config files are situated. Only main site had port 8080. The others didn't which was weird. I changed for the other 2 sites too, hope they will work soon.
As for listening to port:i use this command: lsof -i | grep LISTEN | grep http
Here is a sample of the output: apache2 1317 www-data 4u IPv6 421947410 0t0 TCP *:http-alt (LISTEN) apache2 1317 www-data 6u IPv6 421947414 0t0 TCP *:https (LISTEN) varnishd 13295 nobody 7u IPv4 421875237 0t0 TCP *:http (LISTEN) varnishd 13295 nobody 8u IPv6 421875238 0t0 TCP *:http (LISTEN) apache2 13378 www-data 4u IPv6 421947410 0t0 TCP *:http-alt (LISTEN) apache2 13378 www-data 6u IPv6 421947414 0t0 TCP *:https (LISTEN) apache2 15396 www-data 4u IPv6 421947410 0t0 TCP *:http-alt (LISTEN) apache2 15396 www-data 6u IPv6 421947414 0t0 TCP *:https (LISTEN) apache2 15401 www-data 4u IPv6 421947410 0t0 TCP *:http-alt (LISTEN) apache2 15401 www-data 6u IPv6 421947414 0t0 TCP *:https (LISTEN) apache2 15402 www-data 4u IPv6 421947410 0t0 TCP *:http-alt (LISTEN) apache2 15402 www-data 6u IPv6 421947414 0t0 TCP *:https (LISTEN) apache2 28630 root 4u IPv6 421947410 0t0 TCP *:http-alt (LISTEN) apache2 28630 root 6u IPv6 421947414 0t0 TCP *:https (LISTEN)
Is varnish working correctly?I dont see much speed progress..
I used: https://isvarnishworking.uk/ Fail...ish! We detected Varnish on that domain, but the content doesn't appear to be cached. Best check your configuration.
200: OK server: Apache/2.2.22 last-modified: Thu, 11 May 2017 19:44:09 GMT etag: "18559-54f44cffa1183" accept-ranges: bytes, bytes cache-control: max-age=0, public, public expires: Fri, 12 May 2017 10:22:05 GMT vary: Accept-Encoding,Cookie,User-Agent x-powered-by: W3 Total Cache/0.9.5.4 pragma: public content-type: text/html; charset=UTF-8 content-length: 99673 date: Fri, 12 May 2017 10:22:05 GMT x-varnish: 481663637 age: 0 via: 1.1 varnish connection: close
How to fix this?
Make sure you do not serve cookies/sessions and have the expiration date set well by your web application. If this is a Wordpress site, google for a wordpress example vcl (you may be able to strip some cookies except for the admin part).