hi im using varnish 2.1.5 and varnish module 6.x-1.0 along with pressflow 6.22.

my default.vcl reads:

backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.max_connections = 500;
}

but when i enter 127.0.0.1:8080 on 'Varnish Control Terminal: ' i get 'The Varnish control terminal is not responding at 127.0.0.1 on port 8080' underneath.

Tried 127.0.0.1:6082 also just to try it but same result. Please help? THank you.

Comments

fabsor’s picture

Status: Active » Needs review

Hi!

The Varnish terminal is not on the same port as the varnish process. You specify the port for the terminal should start on when you start the varnish daemon, with the -T flag. The default is usually something like this:
-T localhost:6082

In debian, you control these things in /etc/default/varnish. If you are on another distro, have a look at the init script for varnish, and try to figure out what port you are running the terminal on, it could be in /etc/init.d or /etc/rc.d, it all depends on the distribution.

Also note that you need to specify this flag when starting Varnish, I don't think the terminal will start otherwise.

ghmercado’s picture

thank you so much i found mine at /etc/sysconfig/varnish, and my port was 2000.

fabsor’s picture

Status: Needs review » Fixed

Alright! Setting this to fixed then!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ghmercado’s picture

Hi it's me again.

Recent changes to my server have caused the varnish module to again output a 'The Varnish control terminal is not responding at 127.0.0.1 on port 2000' status.

I've tried '127.0.0.1:80', '127.0.0.1:8080', '127.0.0.1:6080' and '127.0.0.1:6081' to no avail.

here are the contents of my /etc/sysconfig/varnish

NFILES=131072
MEMLOCK=82000
RELOAD_VCL=1
VARNISH_VCL_CONF=/etc/varnish/default.vcl
VARNISH_LISTEN_PORT=6081
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
VARNISH_SECRET_FILE=/etc/varnish/secret
VARNISH_MIN_THREADS=1
VARNISH_MAX_THREADS=1000
VARNISH_THREAD_TIMEOUT=120
VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
VARNISH_STORAGE_SIZE=1G
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
VARNISH_TTL=120
DAEMON_OPTS="-a 0.0.0.0:80 \
             -f /etc/varnish/default.vcl \
             -T 127.0.0.1:2000 \
             -t ${VARNISH_TTL} \
             -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
             -u varnish -g varnish \
#             -S ${VARNISH_SECRET_FILE} \
             -s malloc,256M"

i tried placing '/etc/varnish/secret' in the Varnish Control Key as well, no go.

Please can someone help? I am not very adept at these things. Thank you very much in advance.

jordanmagnuson’s picture

Title: The Varnish control terminal is not responding at 127.0.0.1 on port 8080 » The Varnish control terminal is not responding at 127.0.0.1 on port 6082
Version: 6.x-1.0 » 7.x-1.x-dev

I'm having the same issue in the 7.x version ("The Varnish control terminal is not responding at 127.0.0.1 on port 6082").

Varnish 2.1.x, control key entered on admin page to no effect.

My /etc/default/varnish file looks like this:


# Configuration file for varnish
#
# /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK
# to be set from this shell script fragment.
#

# Maximum number of open files (for ulimit -n)
NFILES=131072

# Maximum locked memory size (for ulimit -l)
# Used for locking the shared memory log in memory.  If you increase log size,
# you need to increase this number as well
MEMLOCK=82000

# Default varnish instance name is the local nodename.  Can be overridden with
# the -n switch, to have more instances on a single server.
INSTANCE=pressflow

# This file contains 4 alternatives, please use only one.

## Alternative 1, Minimal configuration, no VCL
#
# Listen on port 6081, administration on localhost:6082, and forward to
# content server on localhost:8080.  Use a 1GB fixed-size cache file.
#
# DAEMON_OPTS="-a :6081 \
#              -T localhost:6082 \
# 	     -b localhost:8080 \
# 	     -u varnish -g varnish \
#            -S /etc/varnish/secret \
# 	     -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"


## 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 \
             -T localhost:6082 \
             -f /etc/varnish/pressflow.vcl \
             -S /etc/varnish/secret \
             -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,64MB"


## Alternative 3, Advanced configuration
#
# See varnishd(1) for more information.
#
# # Main configuration file. You probably want to change it :)
# VARNISH_VCL_CONF=/etc/varnish/default.vcl
#
# # Default address and port to bind to
# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify
# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.
# VARNISH_LISTEN_ADDRESS=
# VARNISH_LISTEN_PORT=6081
#
# # Telnet admin interface listen address and port
# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
# VARNISH_ADMIN_LISTEN_PORT=6082
#
# # The minimum number of worker threads to start
# VARNISH_MIN_THREADS=1
#
# # The Maximum number of worker threads to start
# VARNISH_MAX_THREADS=1000
#
# # Idle timeout for worker threads
# VARNISH_THREAD_TIMEOUT=120
#
# # Cache file location
# VARNISH_STORAGE_FILE=/var/lib/varnish/$INSTANCE/varnish_storage.bin
#
# # Cache file size: in bytes, optionally using k / M / G / T suffix,
# # or in percentage of available disk space using the % suffix.
# VARNISH_STORAGE_SIZE=1G
#
# # File containing administration secret
# VARNISH_SECRET_FILE=/etc/varnish/secret
# 
# # Backend storage specification
# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
#
# # Default TTL used when the backend does not specify one
# VARNISH_TTL=120
#
# # DAEMON_OPTS is used by the init script.  If you add or remove options, make
# # sure you update this section, too.
# DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
#              -f ${VARNISH_VCL_CONF} \
#              -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
#              -t ${VARNISH_TTL} \
#              -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
# 	       -S ${VARNISH_SECRET_FILE} \
#              -s ${VARNISH_STORAGE}"
#


## Alternative 4, Do It Yourself
#
# DAEMON_OPTS=""

PS: Updating the version of this issue to 7.x dev, as my understanding is that issues are always supposed to correspond with the highest version of a module at which they are an issue--but if I'm wrong please move the version back. Also changing the port number to the default, since that would be the expected working scenario, and it's failing for both of us.

jordanmagnuson’s picture

Tried '127.0.0.1' instead of 'localhost' in my varnish file, but didn't seem to make a difference.

jordanmagnuson’s picture

Sorry, not trying to spam! This will be my last post for the day. Just wanted to say that I tried a couple other port numbers in case of weird fire-walling, but no luck with that. Also, in case it's helpful, here's the result of 'dpkg -s varnish' on my system:

root@mercuryserver:~# dpkg -s varnish
Package: varnish
Status: install ok installed
Priority: optional
Section: web
Installed-Size: 960
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 2.1.0-2ubuntu0.1
Depends: libc6 (>= 2.4), libncurses5 (>= 5.6+20071006-3), libvarnish1 (= 2.1.0-2  ubuntu0.1), gcc (>= 3.3), libc6-dev | libc6.1-dev | libc-dev, adduser
Conffiles:
 /etc/logrotate.d/varnish cd342b7bd5a0157d6ff54832ca60b649
 /etc/varnish/default.vcl 1ee3395482d7d6095e2cc703ea980b71
 /etc/default/varnish 9677eaa0e7231b91f4ba6f2081a4291d
 /etc/default/varnishlog e9872e98cda51febd46fbe26911f0ab5
 /etc/default/varnishncsa 55e0b206cf68b62364f66e9aae59bf0b
 /etc/init.d/varnish dfabaad6aa5eb6b14509c31b3fd106f9
 /etc/init.d/varnishlog de08c9a85c2682cee2971f449aec32b4
 /etc/init.d/varnishncsa 1ade1a4d587a2324adf6bca3ca7d157a
Description: a state-of-the-art, high-performance HTTP accelerator
 Varnish is a state-of-the-art, high-performance HTTP accelerator.  It uses the
 advanced features in Linux 2.6, FreeBSD 6/7 and Solaris 10 to achieve its high
 performance.
 .
 Some of the features include:
  * A modern design
  * VCL - a very flexible configuration language
  * Load balancing with health checking of backends
  * Partial support for ESI - Edge Side Includes
  * URL rewriting
  * Graceful handling of "dead" backends
Homepage: http://varnish-cache.org/
Original-Maintainer: Varnish Package Maintainers <pkg-varnish-devel@lists.alioth  .debian.org>
jordanmagnuson’s picture

Status: Closed (fixed) » Active

Sorry, forgot to re-open this. Argh... I probably should have just posted a new issue, right? Anyway, sorry for all the fumbling :(

Cristian.Andrei’s picture

Check for your varnish secret key (mine is at /etc/varnish/secret). Had the same problem as you and all worked after I placed the varnish secret key in the designated field in the admin UI.

stred’s picture

thanks control key was the key ;)

geekgirlweb’s picture

Status: Active » Closed (cannot reproduce)

(Opps, ignore, closed wrong issue)

geekgirlweb’s picture

Status: Closed (cannot reproduce) » Needs work
blogers’s picture

I hace the same problem but tha key dont work for me

felgharb’s picture

Hello,
I had this pb but by entering secret key and setting to 127.0.0.1:6082 has fixed and the varnish is running

eule’s picture

hello, i have this problem with pressflow 2.8 and varnish 3.x
i try some but nothing is helping!

status says Varnish status Varnish running. Observe more detailed statistics here.
but no stats because of The Varnish control terminal is not responding at 127.0.0.1 on port 6082

spineless’s picture

I had to do the following to get varnish to work. I used a set on instructions provided by Andrew Dunkle. Here is a link:

http://andrewdunkle.com/how-install-varnish-drupal-7

Ofcourse the default.vcl code he provides has a bug in it so I had to fix that....

This is what I did.

1. I did not change the Apache2 setting. (see link above). I just made Varnish look at port 591.
2. I opened port 591 in UFW
ufw allow 591
3. I modified the default.vcl file.

Note: I am using Localhost here instead of 127.0.0.1

# This is a basic VCL configuration file for varnish. See the vcl(7) main page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content server.
#
 backend default {
     .host = "localhost";
     .port = "80";
     .connect_timeout = 600s;
     .first_byte_timeout = 600s;
     .between_bytes_timeout = 600s;
 }

# Respond to incoming requests.

 sub vcl_recv {
  if (req.request == "GET" && req.url ~ "^/varnishcheck$") {
    error 200 "Varnish is Ready";
    }
    if (req.restarts == 0) {
    	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;
 	   }
    }

  # Allow the backend to serve up stale content if it is responding slowly.
  if (!req.backend.healthy) {
    # Use anonymous, cached pages if all backends are down.
    unset req.http.Cookie;
    if (req.http.X-Forwarded-Proto == "https") {
      set req.http.X-Forwarded-Proto = "http";
    }
    set req.grace = 30m;
  } 
  else {
    set req.grace = 15s;
  }

  # Get ride of progress.js query params
  if (req.url ~ "^/misc/progress\.js\?[0-9]+$") {
    set req.url = "/misc/progress.js";
  }

  # If global redirect is on
  #if (req.url ~ "node\?page=[0-9]+$") {
  #  set req.url = regsub(req.url, "node(\?page=[0-9]+$)", "\1");
  #  return (lookup);
  #}

  # Do not cache these paths.
  if (req.url ~ "^/status\.php$" ||
      req.url ~ "^/update\.php$" ||
      req.url ~ "^/ooyala/ping$" ||
      req.url ~ "^/admin" ||
      req.url ~ "^/admin/.*$" ||
      req.url ~ "^/user" ||
      req.url ~ "^/user/.*$" ||
      req.url ~ "^/users/.*$" ||
      req.url ~ "^/info/.*$" ||
      req.url ~ "^/flag/.*$" ||
      req.url ~ "^.*/ajax/.*$" ||
      req.url ~ "^.*/ahah/.*$") {
    return (pass);
  }

  # Pipe these paths directly to Apache for streaming.
  if (req.url ~ "^/admin/content/backup_migrate/export") {
    return (pipe);
  }

  # Handle compression correctly. Different browsers send different
  # "Accept-Encoding" headers, even though they mostly all support the same
  # compression mechanisms. By consolidating these compression headers into
  # a consistent format, we can reduce the size of the cache and get more hits.=
  # @see: http:// varnish.projects.linpro.no/wiki/FAQ/Compression
  if (req.http.Accept-Encoding) {
    if (req.http.Accept-Encoding ~ "gzip") {
      # If the browser supports it, we'll use gzip.
      set req.http.Accept-Encoding = "gzip";
    }
    else if (req.http.Accept-Encoding ~ "deflate") {
      # Next, try deflate if it is supported.
      set req.http.Accept-Encoding = "deflate";
    }
    else {
      # Unknown algorithm. Remove it and send unencoded.
      unset req.http.Accept-Encoding;
    }
  }

  # Always cache the following file types for all users.
  if (req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js)(\?[a-z0-9]+)?$") {
    unset req.http.Cookie;
  }

  # Remove all cookies that Drupal doesn't need to know about. ANY remaining
  # cookie will cause the request to pass-through to a backend. For the most part
  # we always set the NO_CACHE cookie after any POST request, disabling the
  # Varnish cache temporarily. The session cookie allows all authenticated users
  # to pass through as long as they're logged in.
  #
  # 1. Append a semi-colon to the front of the cookie string.
  # 2. Remove all spaces that appear after semi-colons.
  # 3. Match the cookies we want to keep, adding the space we removed
  #    previously, back. (\1) is first matching group in the regsuball.
  # 4. Remove all other cookies, identifying them by the fact that they have
  #    no space after the preceding semi-colon.
  # 5. Remove all spaces and semi-colons from the beginning and end of the
  #    cookie string.
  if (req.http.Cookie) {
    set req.http.Cookie = ";" + req.http.Cookie;
    set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
    set req.http.Cookie = regsuball(req.http.Cookie, ";(S{1,2}ESS[a-z0-9]+|NO_CACHE)=", "; \1=");
    set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
    set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

    if (req.http.Cookie == "") {
      # If there are no remaining cookies, remove the cookie header. If there
      # aren't any cookie headers, Varnish's default behavior will be to cache
      # the page.
      unset req.http.Cookie;
    }
    else {
      # If there is any cookies left (a session or NO_CACHE cookie), do not
      # cache the page. Pass it on to Apache directly.
      return (pass);
    }
  }

  ## From default below ##
  if (req.restarts == 0) {
    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;
    }
  }
  if (req.request != "GET" &&
    req.request != "HEAD" &&
    req.request != "PUT" &&
    req.request != "POST" &&
    req.request != "TRACE" &&
    req.request != "OPTIONS" &&
    req.request != "DELETE") {
      /* Non-RFC2616 or CONNECT which is weird. */
      return (pipe);
  }
  if (req.request != "GET" && req.request != "HEAD") {
      /* We only deal with GET and HEAD by default */
      return (pass);
  }
  ## Unset Authorization header if it has the correct details...
  #if (req.http.Authorization == "Basic ") {
  #  unset req.http.Authorization;
  #}
  if (req.http.Authorization || req.http.Cookie) {
      /* Not cacheable by default */
      return (pass);
  }
  return (lookup);
}

# Code determining what to do when serving items from the Apache servers.
sub vcl_fetch {
  # Don't allow static files to set cookies.
  if (req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js)(\?[a-z0-9]+)?$") {
    # beresp == Back-end response from the web server.
    unset beresp.http.set-cookie;
  }
  else if (beresp.http.Cache-Control) {
    unset beresp.http.Expires;
  }

  if (beresp.status == 301) {
    set beresp.ttl = 1h;
    return(deliver);
  }

  ## Doesn't seem to work as expected
  #if (beresp.status == 500) {
  #  set beresp.saintmode = 10s;
  #  return(restart);
  #}

  # Allow items to be stale if needed.
  set beresp.grace = 1h;
}

# Set a header to track a cache HIT/MISS.
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Varnish-Cache = "HIT";
  }
  else {
    set resp.http.X-Varnish-Cache = "MISS";
  }
}

# In the event of an error, show friendlier messages.
sub vcl_error {
     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
     synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
   <head>
     <title>"} + obj.status + " " + obj.response + {"</title>
   </head>
   <body>
     <h1>Error "} + obj.status + " " + obj.response + {"</h1>
     <p>"} + obj.response + {"</p>
     <h3>Guru Meditation:</h3>
     <p>XID: "} + req.xid + {"</p>
     <hr>
     <p>Varnish cache server</p>
   </body>
</html>
"};
}

4. I updated the setting.php file to what Andrew mentioned.


$conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['reverse_proxy'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
$conf['cache'] = 1;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 21600;
$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['reverse_proxy_addresses'] = array('[my internal ip address]');
$conf['omit_vary_cookie'] = TRUE;

5. On the Drupal website. Go to /admin/config/development/varnish

Then enter the following

Flush page cache on Cron?: Disabled (Drupal should not be controlling cron on anyway.)
Varnish Version: 3.x
Varnish Control Terminal: localhost:6082
Varnish Control Key: [ Enter the value of the secret key from the secret file located at /etc/varnish]
Varnish connection timeout: 100
Varnish Cache Clearing: Drupal Default
Varnish ban type: Normal

Save the configuration and it should return a "Varnish running" statement.

wOOge’s picture

Issue summary: View changes

Solution in #10 worked for me: Using the secret key inside the /etc/varnish/secret file on the module config page fixed it for me.

click2tman’s picture

I had the same problem but solution in #10 worked for me: I used the secret key inside the the file /etc/varnish/secret file on the module config page at admin/config/development/varnish to fix it.

bdupls’s picture

Maybe a silly question to some but how do I edit/open the secret file to read the key, permissions issue?

john_b’s picture

Log in to server from command line. Issue command
cat /etc/varnish/secret

socialnicheguru’s picture

Number 10, 22 are right

misc’s picture

Status: Needs work » Closed (outdated)
prakashsingh’s picture

#18 worked for me on Ubuntu 14.x

I had to make the said changes in settings.php as mentioned.. above.

Thanks

mrcelli’s picture

Solution in #10 worked for me too on RHEL.
type the following:
more /etc/varnish/secret
then copy paste the secret key into the Varnish Control Key field of the UI.

francescosciamanna’s picture

To whom may running this problem, you need to take in account that the Varnish Control Key may change over the time, so if you are running into this error over the time, you need to check if the Varnish Control Key changed recently in your /etc/varnish/secret, and compare its value if is the same set to your Varnish Control Key, in your Drupal Varnish module settings.