Archive for the ‘Tech’ Category.
July 29, 2010, 7:45 PM
Initially, logging Varnish didn’t really work that well. Varnish, by default, doesn’t log (varnishncsa can do some logging, but I haven’t figured that out yet.) I’ve been parsing my logs with JAWstats, which reads the Apache logs. However, by default, varnish will replace the IP address of the originating client with the IP address of the proxy server, meaning all traffic will look like it comes from my single server. This is what an entry looks like
173.230.157.240 - - [29/Jul/2010:15:47:47 -0700] "GET / HTTP/1.1" 200 20046 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)"
173.230.157.240 - - [29/Jul/2010:15:47:48 -0700] "GET / HTTP/1.1" 200 20046 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)"
173.230.157.240 - - [29/Jul/2010:15:47:49 -0700] "GET / HTTP/1.1" 200 20046 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)"
173.230.157.240 - - [29/Jul/2010:15:47:50 -0700] "GET / HTTP/1.1" 200 20046 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)"
Yeah, I made this up, but you get the idea.
That’s no good. How will I tell that I’m famous in Sweden? I found a way to get the client IP information passed to the backend
Continue reading ‘Setup logging for Varnish – The right way’ »
July 25, 2010, 12:10 PM
So far, we’ve got Varnish installed and have a correct default.vcl. Now let’s make sure AWStats/JAWStats can read them.
In your default.vcl, make sure you have this stanza. Otherwise, the Apache log files will only show traffic from your proxy server IP address. This allows the client.ip to be forwarded to your log file.
sub vcl_recv {
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
}
Continue reading ‘Setup logging for Varnish’ »
July 25, 2010, 11:50 AM
I wasn’t able to get the varnish logs in a format awstats/jawstats could understand. After a LOT of googling, I’ve gotten this to work. I added
sub vcl_recv {
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
}
as you can see below.
Continue reading ‘Updated Varnish default.vcl’ »
July 24, 2010, 9:41 PM
I’ve been wanting to play around with a Web Cache/proxy in front of my web server, just to see how hard it would be and how well it would work.
Initially, I was going to try Squid, which is used far and wide. Pretty quickly I found out about Varnish, which is supposed to be easy to use, and quick to install. That may have been true, but getting it to work with WordPress was relatively painful for me. However, once I got it working, it made some crazy improvements in the speed of this site.
I won’t go into too much detail about the more standard parts. Should you need help with things like installing or finding packages, Varnish might not be for you. I will also assume you have a fully functional WordPress installed on Apache 2.
Install Varnish
Configure your Varnish config file (/etc/varnish/default.vcl.) Here is mine (also, check THIS post.)
Continue reading ‘How to use Varnish cache with WordPress’ »
May 20, 2010, 2:49 PM
We have a need to provision a bunch of Linux VM’s relatively quickly. We could do them by hand, but frankly, I’m too lazy to build 150 VM’s by hand. This is a very rough way to do it.
First you need a Customization Specification filled out for each server. It’s entirely scriptable, but I won’t be going into the details of that. This is what the Customization Specification looks like
Continue reading ‘Mass provisioning of VM’s’ »