I've got one droplet, currently set up to serve both WordPress via nginx/php5-fpm and Rails via passenger. I'm trying to set varnish up in a way where it's only being used for the WordPress sites, but not for the Rails sites.
I followed the guide in the tutorial setup section, and here's my config setup:
Any attempt to access http://joostschuur.com (WordPress) just loads up the first site configured, i.e. hellorails.joostschuur.com (Rails). It looks like varnish is passing something along to nginx, nginx goes 'Err, don't know that server/port, here, have the default one instead'.
I have tried playing around with the listen directive. using 127.00.0.1:8080 from the tutorial e.g. didn't help.
The setup I want is for varnish to immediately pass any Rails site I'm accessing to nginx, and handle caching for any WordPress sites as needed.
So I think my current problem isn't even related to varnish yet. It's purely an nginx config issue, getting multiple server blocks to listen on different ports. After that's solved, I'm going to need to have all the nginx sites (even the Rails ones) run on prt 8080 presumably.
(Note that right now, I have Varnish disabled until I figure this out, so joostschuur.com loads up just fine again, just with no caching).
These answers are provided by our Community. If you find them useful, show some love by clicking the heart.
If you run into issues leave a comment, or add your own answer to help others.