0

I've added SPDY to my server last week which is running Varnish for cashing and Nginx as webserver.

Varnish was listening at port 80 and Nginx at 8080 and 443. Traffic at 8080 is redirected using

rewrite ^ https://www.maartenprovo.be$request_uri permanent;

Now however Varnish is listening at port 80 and 443 and Nginx at 8080 and 444.

In /etc/default/varnish I changed

DAEMON_OPTS=”-a :80 \

to

DAEMON_OPTS="-a :80,:443 \

Then I made this for /etc/varnish/defacult.vcl :

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

# Port 443 Backend Servers for SSL
backend web_ssl {
    .host = "127.0.0.1";
    .port = "444";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .between_bytes_timeout = 600s;
    .max_connections = 800;
}

acl purge {
        "localhost";
}

# Respond to incoming requests.
sub vcl_recv {
  # Set the director to cycle between web servers.
  if (server.port == 443) {
    set req.backend = web_ssl;
  }
  else {
    set req.backend = web;
  }

...
}

But it doesn't work ... Where did I go wrong?

  • I'm assuming you're checked your varnish configuration (varnishd -C -f VCLFileLocation). If so, what do you see in the varnish logs when you access a URL hitting port 80 or 443? – ali haider Dec 26 '13 at 22:58
  • What "doesn't work"? – Michael Hampton Dec 26 '13 at 23:56
  • It gives a page not found. But as my further research of today shows Varnish does not support SSL. So what I want is not possible. I will have to look at other options to cache the SSL. – Maarten Provo Dec 27 '13 at 22:22
  • 1
    While Varnish doesn't support SSL, it can be used along with Nginx and SPDY. For such a setup, the server stack would look like... Nginx (for SSL termination) => Varnish (for caching) => Nginx (as a simple web server) => application. I hope that helps! – Pothi Kalimuthu Jan 02 '14 at 10:14
  • You don't need Varnish, since nginx itself has pretty rich caching functionality. – VBart Feb 09 '14 at 01:00

0 Answers0