Help on configuring Varnish for both non-SSL and SSL

I am running a few Wordpress sites and plan to run another one in the next month or so. That one WordPress site will most likely be with high traffic, so I want to plan ahead and add some caching. I have a 2GB Linode and already have APC for PHP opcode caching. Now I want to add Varnish to the game.

I have Roundcube on my Linode which is SSL encrypted and I plan to set up rewrite rules in nginx so it redirects to HTTPS when accessing admin panel.

The thing is, I've read numerous articles on the Web about putting Varnish in front of nginx, that is, put it to listen on port 80 and then set up nginx on some other port. That works great when you have only HTTP traffic, but when you add HTTPS to the mix, all goes down really bad.

I would like to know whether it is possible to configure Varnish so that it sits in front of nginx and proxies requests to nginx for both SSL and non - SSL web sites. How do I configure Varnish for that scenario? Basically, I would like to know what is the best practice when it comes to setting up Varnish for this kind of scenario. Should Varnish listen on some particular port and sit in front of nginx or there is a better way for doing that?

It would be perfect if someone could point me to some links on the Web so I can read more about setting this thing up. Thanks in advance for all your suggestions.

1 Reply

Your https traffic should be coming in to port 443, not port 80. You can configure Varnish to listen on one and another daemon (such as nginx) to listen on the other.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct