Varnish cache on Dreamhost
July 26, 2014 2:17 PM   Subscribe

I have a VPS on Dreamhost. I wonder, has anyone ever gotten Varnish Cache working on it?

I am confused by a few things--apologies for the newbie-ness of this:

* After I start the Varnish demon it does not always seem to stick around. I am not sure how to find out why it dies, because...

* When it's running, I cannot seem to get Varnishlog to start logging to give more information (I check in /var/log/varnish but nothing shows up). Other times it says "varnishlog failed."

* Can't seem to test to see whether the port is really relaying and up and running, as suggested in this link. When I try the recommended GET to localhost at various ports, I get "500 Can't connect to www.ibew1245.com:8080 (connect: Connection refused)"

I did figure out how to increase all necessary limits: the # of files and amount of memory-locked-in-memory-address-space the root user is allowed to use. That made a bunch of Ulimit-related error messages go away. Wonder what to try next...I am hesitant to just make Apache just start trying to listen to one of those ports because I don't think we are at the stage when anything is coming through yet.

Any help much appreciated...
posted by johngoren to Computers & Internet (4 answers total)
 
I've never used Dreamhost, but I have used Varnish.

varnishlog needs to have the correct options to find the right socket to talk to varnish on. That depends on how you're starting varnish and varnishlog. What's the command?

What port is varnish supposed to listening on, and what is it supposed to access? I imagine you have it set up on a port other than 80 for testing, and will move it to 80 when you're ready.

I didn't see the GET command to localhost when I skimmed the link… are you doing something like wget http://localhost:8080/?
posted by Renegade Duck at 4:39 PM on July 26, 2014


Response by poster: The command is:

/usr/sbin/varnishd -P /var/run/varnishd.pid -a :6081 -T localhost:6082 -b localhost:8080 -u varnish -g varnish -S /etc/varnish/secret -s file,/var/lib/varnish//varnish_storage.bin,1G

The GET was something like:

GET -Used http://www.domain.com:8080/
posted by johngoren at 5:55 PM on July 26, 2014


That command sets up varnish to listen for requests on port 6081 and to communicate with the backend server on port 8080. Assuming you're running Varnish in front of Apache, Apache would be running on 8080. In diagram form:

Internet ↔︎ 6081 : Varnish ↔︎ 8080 : Apache

Your GET is checking if your backend server is working, and it's telling you there's nothing running on port 8080. That's why Varnish isn't working — it doesn't have anything to get pages from.

Assuming that you have Apache running on 80 (the normal HTTP port), and you want to set up Varnish on 8080 (for now, so you can try it before you put it into production), you'll want this command:

/usr/sbin/varnishd -P /var/run/varnishd.pid -a :8080 -T localhost:6082 -b localhost:80 -u varnish -g varnish -S /etc/varnish/secret -s file,/var/lib/varnish//varnish_storage.bin,1G

At that point, GET -Used http://www.domain.com:8080/ should work, and if you have the port opened in your firewall (assuming you have one), then you should be able to go to port 8080 on your website and see the Varnish version. (Presumably http://www.ibew1245.com:8080/)
posted by Renegade Duck at 10:11 AM on July 27, 2014 [1 favorite]


Response by poster: Word, thank you, I am going to give this a try.
posted by johngoren at 10:25 AM on July 27, 2014


« Older Identify this mystery flag!   |   Books about WW2 in Asia, Africa, and the Pacific Newer »
This thread is closed to new comments.