3

I have a site that is currently using Varnish for caching HTTP requests, however for several reasons it is doing more harm than good.

My problem is that I can't find a way to stop all http requests going through it. If I stop the varnishd service then the whole site goes down. The varnish statup options indicate that is using port 2000, but there is nothing on Apache that seems to tie into it. The Apache config points to the standard port 80.

This is CentOS box, with Apache 2.2.3, Varnish 2.0.6

user9517
  • 115,471
  • 20
  • 215
  • 297
oarevalo
  • 161
  • 1
  • 1
  • 6

3 Answers3

6

Check the Varnish VCL (probably default.vcl) to see what the address of the backend server it's using (you can see this as part of the Backend directive). This is probably using a non standard port such as 8080.

Next you'll need to do the following:

  1. Edit Apache Config to bind to port 80
  2. Kill Varnish
  3. Restart Apache on 80
Tom
  • 766
  • 3
  • 9
  • 24
  • Thanks! This worked great. The only difference was that Apache and Varnish were both using port 80 but were bound to different IPs (Varnish had the outside IP, and Apache had localhost). –  Jun 07 '11 at 17:33
0

Try getting Apache to listen on port 2000 then. It might be that there is a firewall rule that is mapping all connections for port 80 to port 2000.

Gerry
  • 378
  • 2
  • 3
  • 13
0

If you want to keep varnish running, but only pass requests back to the backend server (perhaps while you are tweaking/fixing the default config) you can temporarily change the vcl_receive() function to something like this (untested):

sub vcl_recv() {
  return (pipe);
}

Then restart varnish:

>sudo service varnish restart

This will pass the request/connection back to a backend until the connection is closed.