Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Jun 8 '11 at 21:12

This question came from our site for professional and enthusiast programmers.

... I thought you were talking about wood varnish. – Kaleb Brasee Jun 6 '11 at 22:33
what do you mean by 'whole site goes down'? varnish is (just) a cache. How do you publish content (dynamically or statically)? – mkro Jun 6 '11 at 22:58
After I kill the varnishd processes, the browser can no longer connect to the server – oarevalo Jun 6 '11 at 23:18
Bind apache to the IP:port that varnish is bound to. – Frank Farmer Jun 7 '11 at 0:02
up vote 6 down vote accepted

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
share|improve this answer
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). – oarevalo Jun 7 '11 at 17:33

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.