How to setup lighttpd with a self signed ssl cert on debian with multiple host’s using name based virtual hosting.
Jan 27th
Now first off let me say I take no responsibility if this works for you or not.
Also please note that this will only use the one self signed cert we’re going to make across all hosts, which is still encryption, just looks funny if your hosting for more then one business, being all the site’s I have on my server are my own, I don’t really care I just wanted some ssl encryption on my logins to my blogs and pages where I don’t want to send data in the clear. So going to https://stinebaugh.info will give you the same cert as going to http://twig.gs will, but they are still secure.
First off let’s create our self signed certificate. Yes this will throw your browsers into a panic but if you save your exception to the warning permanently (which is fine) you’ll only see it once, plus it’s free
sudo openssl req -new -x509 -keyout selfsigned.pem -out selfsigned.pem -days 3650 -nodes
This will then ask you a bunch of questions that you can fill out for yourself, the one that matters is the -> Common Name (eg, YOUR name) []: prompt which is asking for the exact domain name you plan on using (eg. stinebaugh.info) and will create a .pem file in whatever directory your in (so choose a non web accessible folder like /etc/lighttpd/ for it as this is a secret!) the expiration date of the cert file is noted in my example using 3650 which will generate a cert that’s good for 10 years! (hey it’s self signed, do I really want to do this every year?!) Feel free to change it as you see fit.
Now let’s lock that file down with some permissions.
sudo chown www-data:www-data selfsigned.pem
sudo chmod 600 selfsigned.pemNow being debian is awesome as well as lighttpd, you can just enter in the command
sudo lighty-enable-mod ssland it will enable the ssl extention for lighttpd!
now let’s setup lighttpd’s ssl conf.
cd /etc/lighttpd/conf-enabled/
sudo nano 10-ssl.confand it should look something like this.
$SERVER["socket"] == "0.0.0.0:443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/selfsigned.pem"
server.document-root = "/var/domain/http" #or wherever you web directory is so it doesnt display just the lighttpd default
}now restart lighttpd
sudo /etc/init.d/lighttpd force-reloadyour lighttpd server should now reboot without any errors you can check the syntax for errors if you want by entering in
sudo lighttpd -t -f /etc/lighttpd/lighttpd.confnow try your server by viewing a page using https such as https://stinebaugh.info and viola you should get that warning in your browser like I was saying and it shoud be just fine after you accept it!
Your Welcome!
Nginx Startup and Shutdown bat files with prompts and auto start at boot!
Jan 24th
So if you’ve read my previous post’s I’m running the latest stable nginx server here on my local laptop to serve up my own search page 
or for when I’m blocking ad’s to have a page that fills in the void’s (and shows me just how well it does work!) 
But I left out a major point… You will need to open a command prompt and enter the C:\nginx directory and start nginx each and every time you bootup. That’s no fun even for a geek like me that spends half of his time on windows in an ssh terminal running back to one of my many linux pc’s but that’s still something we need to fix and like now!
So I did some digging around on google, and all of the post’s I’m reading say to use the .bat file located in the install, but the latest stable release of nginx DOESN’T INCLUDE THESE or ANY .bat FILES! Needless to say, that meant more work, and a quick intro into the quick grace at simple programming to have things done for you! So, Let’s build the start-nginx.bat file! (Note I’m running Windows 7 Ultimate Signature Edition, so this should work for you as well but let me know in the comment’s if it doesn’t!)
- @ECHO off
- start nginx.exe
- echo Starting nginx
- exit
We don’t need anything neat or pretty on the start up as we just want it to run with minimal interference to our start up routine (remember this will be automated later) Also note, that this .bat file needs to be in the C:\nginx folder along with nginx.exe for it to work properly!
Here’s the pimpish part, the shutdown .bat file. (I mostly just modified the file I found here) but it works great!
- @echo off
- echo Stopping Nginx…
- :SETYESNO
- set /p yesno= Would you like to kill nginx? [y/n]:
- if "%yesno%"=="" (echo You didnt enter anything -- try again..) & (goto SETYESNO)
- if /I "%yesno%"=="n" (goto NOKILL)
- if /I "%yesno%"=="y" (goto KILL) else (echo Unrecognized command -- try again) & (goto SETYESNO)
- :KILL
- echo.
- echo Killing Process...
- nginx -s stop
- goto QUIT
- :NOKILL
- echo.
- echo Aborting kill...
- :QUIT
- echo.
- pause
There’s also an interesting idea on turning nginx into a window’s service if your into a bit more of a hacking mood then I was at 2:30 am writing this.
Also you can change the commands I’ve highlighted on line 11 with any one of the commands from the nginx site such as let nginx shutdown gracefully, reload itself etc. just remember that each line will execute in a command prompt as if you typed it so let your minds wander on this one! .bat files are your friend! (also as a side note if you don’t want to have to click any button to continue replace pause on line 18 with exit)
Now let’s get nginx running on our bootup. Right click the start-nginx.bat file and select “Create Shortcut”. Name it whatever you like and then right click the shortcut you just made and cut (or copy) the shortcut and let’s add it to our startup folder in the all programs list.
Click your start menu, choose all programs, scroll down to the startup folder, right click it and choose “Explore” or “Open” and paste your shortcut into this folder. (allow any prompt’s that windows throws at you for needing admin right’s) and you should be good to go!
If this worked for you or you have any questions that google can’t answer or just want to say thanks please feel free to post a comment! That’s why I do this!!! You’ll notice the lack of ad’s or shameless begging for donations, all I want is your thanks!
Pimping out your Linksys WRT54G
Jan 17th
So you have yourself a normal off the shelf wrt54g wireless router and you’d like to get more out of it, well here’s some work I’ve done to mine and it’s not too hard and the benefit’s are WELL worth the effort!
What I’ve done is installed the awesome DD-WRT firmware, installed a heat-sink, adjustable cooling fan, potentiometer, and switch to adjust or stop the fan when the noise is not wanted. (really it was more for fun as the heat-sink alone does most of the work allowing you to overclock your router’s processor)
Also it’s been very stable since the upgrades and I am really quite happy with it! And for less then $30.00 worth of parts and some time and effort it’s a bad ass VERY capable router!
Here’s some pic’s of the work involved.
All of the part’s were available at my local Radio Shack including the heat sink (however I did need to trim it down using a dremel) thermal paste, wire, switches, light’s, potentiometer and fan for around $30 bucks. So for under a bill you too can have a pimping router that should run nice and stable, and fast for several years. Worthy? Absolutely! Nerdy, probably more then your router! If you’ve done any good mods to your router please feel free to post them in the comments and don’t forget to give me a thumbs up!
Truecrypt Stepping Up Encryption and Plausible deny-ability.
Jan 15th
Now if your paranoid I’m sure you’ve already discovered the great and mighty Truecrypt to encrypt your whole drive, but there’s a lesser reported feature they’ve included that will give you another reason for “plausible deny-ability” in so much as you don’t wan’t to be hastled by air traffic control asking your password’s, or even tip them off that you have your full drive encrypted in the first place, How about when you boot your pc for them, the dredded “Missing operating system” message pop’s up instead of the truecrypt boot manager?! Here’s how you do that.
Of course I’m assuming you already have Truecrypt installed and your drive encrypted. If you don’t there’s a ton of posts out there that will help you along the way.
Boot into your OS of choice and open Truecrypt. Open the Settings Option from the menu.
From the Setting’s menu, choose “Preferences” which will open another window full of options.
From that window, Choose the button at the bottom that say’s “More Options”
From the menu that pop’s up, choose “Encryption Settings…”
This will bring up yet another window, that will have the setting’s we’ve been looking for. Put a checkmark in the first box “Do not show any text in the preboot…..” and then choose what you’ld like it to say instead, such as “Missing operating system” but DO read the notes below as they tell you stuff like no text will be displayed when you enter your password or an incorrrect password. Good to know before you think you really did corrupt your MBR!
That’s it! Now when you power on your PC you’ll be greeted with the scarry word’s “Missing operating system” however you’ll still be able to login and your OS should start without any issues! So again, I say Thanks Truecrypt!
(on a side note you might wan’t to bring along an old copy of your XP install disk just in case someone at the airport or what have you, does ask why your bringing a broken laptop with you.)
Serious DIY System Wide Ad Blocking How-to for Free!
Dec 24th
Alright so there’s a ton of addons for firefox that will let you skip all the ad’s on most sites out there, but let’s say you want to do that in all your browsers! Here’s a great roll your own way of doing it with a few free software install’s on your own pc that will block most any ad’s as well as display whatever you want it to in there places!
Here’s some examples.
Facebook:
Hulu Desktop:
Myspace:
Information Weekly:
And all of this is done before a request is sent out so they never have to know!
What’s going on is I’ve edited my HOSTS file and have a local web server to serve up the error pages.
Really it’s simple. I promise! The hardest part is designing the error page’s html
(and I’ll include mine as well below)
So first off you need to edit your HOSTS file. This is like your pre DNS lookup so if you have sites you frequent often and would like them to load slightly faster, add them to your hosts file and it will save a request to your DNS Server (usually given by your ISP however I recommend OpenDNS or google’s new DNS which seems pretty fast!)
The program I use to edit my HOSTS file is called Hostman and it’s a great little app that runs at startup and will let you know if there’s updates to the built in list’s that they offer. You of course can add your own sources to it if you so choose however they do a pretty good job and are updated often. Along with that you can use the built in http server to report the IP of the site’s being blocked however I wanted a better error page so I installed my own http server using NGINX locally as it uses very little resources and works a treat!
So you’ve got Hostman installed, selected the blocklists that you want (and or added your own sources like bluetack or whatever) and have updated your HOSTS file. Great! Now let’s get to NGINX’s configuration!
Download and extract the NGINX file’s to your root drive (ie C:/) so you have a folder C:/nginx inside there you’ll find a folder called conf and of course that’s where the configuration file’s are located. Open C:/nginx/conf/nginx.conf with your favorite editor (I love Notepad ++) and on line 48 you’ll see something like this:
error_page 404 /404.html;
location = /404.html {
root html;This will tell you the directory for your custom error page to be displayed everytime an ad is blocked. Mine looks like this:
<html>
<head>
<title>Room 404</title>
<style>
body { font-family: monospace, Arial, sans-serif, Tahoma, Verdana,; }
</style>
</head>
<body bgcolor="black" text="white">
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
Room <font color="#FF0000">404</font><br/>
Dan's Blocking Ad's<br/>
Sorry.. Kinda.
</td>
</tr>
</table>
</body>
</html>This will center the text both horizontally and verticly. and display it on a black background with white text (unless otherwise noted like my red text)
You of course can add images, or whatever else you might find interesting, and it will be displayed. I like this because it’s fast and light so there’s no delay displaying it on the webpage.
Once you’ve added your changes (if you made any) you need to start NGINX and that’s just a quick press of the Windows button, type in cmd and simply change directory’s to the nginx folder
cd C:/nginxthen starting the NGINX Server.
C:/nginx> start nginxYou’ll see a window open ever so briefly and then dissapeer you should now be able to go into your web browser and go to http://localhost and be shown your homepage running on NGINX locally, try http://localhost/error and you should see your error page pop on screen. Viola! Your http server is working properly!
Now the nice thing about this setup is it works system wide, so ANYTHING making a query over the internet is subject to the blocking power of this setup so if you have a program that’s ad supported and it no longer works this might be the cause, however I believe even that would be a very rare occurrence.
I Hope this setup helps you keep your speed and privacy up this holiday season and Merry Christmas to you all! (You’ll also note that I don’t have any ad’s on my sites, feel free to thank me in the comment’s if you appreciate this!)


















