Archive for the ‘Tech’ Category.

Setup logging for Varnish

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’ »

Updated Varnish default.vcl

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’ »

How to use Varnish cache with WordPress

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’ »

Mass provisioning of VM’s

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’ »

SSH Tips

SSH is one of those things I use every day, and maybe what I use most throughout the day. These are either things I didn’t know (escape sequences), or haven’t looked into before.

To get to the SSH escape sequences, you need a new line, followed by ~ and ?. That’s a newline (return), followed by a tilde and a question mark. This is what you get

Supported escape sequences:
  ~.  - terminate connection (and any multiplexed sessions)
  ~B  - send a BREAK to the remote system
  ~C  - open a command line
  ~R  - Request rekey (SSH protocol 2 only)
  ~^Z - suspend ssh
  ~#  - list forwarded connections
  ~&  - background ssh (when waiting for connections to terminate)
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

There are a lot of interesting things you can do with this. My favorite being if you ssh to host1.cainmanor.com then ssh to host2.cainmanor.com and then ssh to host3.cainmanor.com and host3.cainmanor.com locks up, you can newline ~~~. and the third session will be closed.

But wait!! There’s more
Continue reading ‘SSH Tips’ »