Configuring Lighttpd for WordPress with Rewrites

Today I had to configure a WordPress website to use Lighttpd. I looked for the proper rewrites to use and only received garbled information about the rewrites. So instead of forgetting it again for the umpteenth time, I will post my getting WordPress to work with Lighttpd tips / tricks here.

First up there are three key rewrites to get Lighttpd to work with WordPress. They are as follows: (note mod_rewrite will need to be enabled and this is in the lighttpd.conf).

url.rewrite = (
        "^/(wp-admin|wp-includes|wp-content)/(.*)" => "$0",
  "^/(.*).(.+)$" => "$0",
  "^/(.+)/?$" => "/index.php/$1"
)
									

The second key item is making sure that the error handler is set properly.… Read More

Stop Crontab from Sending Emails

This week I was starting to get fed up with Crontab and it always sending me emails regarding jobs. I have log files setup and prefer to look at my logs for errors vs crontab flooding my inbox. I never can seem to remember the 2>&1 trick, as I do not constantly use crontab. So I went exploring in the manual and found a nice little track to stop crontab from flooding your sever mail file with mail. Simply put MAILTO='' at the top of your crontab and you are set. No more trying to remember the tricky 2>&1 or any other weird hacks.… Read More

Tricks to a Simple and Secure Contact Form using PHP

A day does not go by it seems that someone is asking how to create a simple contact form in PHP. The problem I tend to find is that most of the tutorials online show bad programming practice, such as using the @ error suppressor or not validating / checking the data passed into the form. I decided to write up a few of my tricks on how to do a proper PHP Secure Contact form and attempt to explain why. As always, I welcome comments / suggestions in the remarks. I have decided to omit the Captcha, as I feel Captcha is just broken, so if you want to prevent spam, you will need to research other methods, like Honey Pots.… Read More

Varnish is Running out of Control!

A slug walking across a keyboardMy servers now a days run Varnish simply for the speed. On my main site Varnish was getting out of control with the RAM / Memory usage. Varnish would slowly creep up and eat all the memory, even though I was trying to hack Varnish to only use 128MB of ram, especially since the site is hosted on a lowendbox by Frantech (Buyvm.net). The answer, which I am not really sure WHY it works, but inside of vcl_fetch in the /etc/varnish/*.vcl file, I had set beresp.grace to be 30M, I tried this with 2M as well, but ultimately I took out the grace period setting and now my box is running Varnish with Lighttpd and PHP-FPM getting around 15k-30k unique hits a day and not going over 156MB of RAM usage.… Read More

Redmine on Debian 6 with Unicorn and NGINX

A unicorn with it's refelction in water.Redmine is perhaps my favorite Bug tracking, ticketing, wiki, forum, documentation software there is. My only complaint in the past about Redmine was the fact that you needed to use Passanger to run it (which is a RAM hog). Having a bunch of low end VPS’s (Virtual Private Servers) I decided to attempt hacking Redmine onto a 128MB Ram box. Well after doing my research I came upon a neat little trick, Unicorn. Unicorn is a webserver that we can use in place of Passanger to serve Redmine to NGINX, our main webserver. Time to gallop to the setup.… Read More

Trick to Take Flash Screenshots on Headless Linux

A man with a magnifying glass, trying to increase the size.
Along with the Slunked blog site I also run a Flash Game site, GameUsage.com. Recently I have been wanting to hack the code a little to provide a screenshot of each game. Unfortunately, all of my servers are linux based and have no monitor attached (headless). I began thinking a little bit outside of the box and came up with a trick to capture a flash game screenshot (should also capture with or without in-game ads) on a 256MB VPS server I run. The script is very lightweight, and easy to setup for automation with with a cron jobs. I find that the screenshots for the Games to be of decent quality, especially for something that takes a small amount of time and effort to setup.… Read More

↑ BACK TO THE TOP ↑