January 7th, 2010
For CPanel Servers, ConfigServer firewall a must
The crew at ConfigServer have created an awesome (Free) firewall plugin for CPanel that makes security a breeze. I’ve loaded it on all our servers and am really impressed. You can hop over to more information about ConfigServer, or follow the simple instructions I’m archiving here:
###############################################################################
# Copyright 2006-2009, Way to the Web Limited
# URL: http://www.waytotheweb.com
# Email: sales@waytotheweb.com
###############################################################################
Installation
============
Installation is quite straightforward:
rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
Next, test whether you have the required iptables modules:
perl /etc/csf/csftest.pl
Don't worry if you cannot run all the features, so long as the script doesn't
report any FATAL errors
You should not run any other iptables firewall configuration script. For
example, if you previously used APF+BFD you can remove the combination (which
you will need to do if you have them installed otherwise they will conflict
horribly):
sh /etc/csf/remove_apf_bfd.sh
That's it. You can then configure csf and lfd by edit the files
directly in /etc/csf/*, or on cPanel servers use the WHM UI
csf installation for cPanel is preconfigured to work on a cPanel server with all
the standard cPanel ports open.
csf installation for DirectAdmin is preconfigured to work on a DirectAdmin
server with all the standard DirectAdmin ports open.
csf auto-configures your SSH port on installation where it's running on a non-
standard port.
csf auto-whitelists your connected IP address where possible on installation.
You should ensure that kernel logging daemon (klogd) is enabled. Typically, VPS
servers have this disabled and you should check /etc/init.d/syslog and make
sure that any klogd lines are not commented out. If you change the file,
remember to restart syslog.
See the readme.txt file for more information.
Webmin Module Installation/Upgrade
==================================
To install or upgrade the csf webmin module:
Install csf as above
Install the csf webmin module in:
Webmin > Webmin Configuration > Webmin Modules >
From local file > /etc/csf/csfwebmin.tgz > Install Module
Uninstallation
==============
Removing csf and lfd is even more simple:
On cPanel servers:
cd /etc/csf
sh uninstall.sh
On DirectAdmin servers:
cd /etc/csf
sh uninstall.directadmin.sh
On generic linux servers:
cd /etc/csf
sh uninstall.generic.sh
January 7th, 2010
Custom 404 Error Pages in Codeigniter (the easy way)
For those who have worked with the Codeigniter framework, you may have wanted to customize your error pages, specifically the 404. It looks like most of the developers on the forums are coming up with more complicated ways then necessary. The easiest way is to edit the following file:
/includes/application/errors/error_404.php
I opted for a customized background image, specific link and some modified copy. You could of course treat this like a view and do more dynamic things… but really? it’s a 404 page, let’s keep it simple people.
Here is an example of the one I put together: http://www.campuslive.com/somecrazyjibberishurl
Published in: Web DevelopmentMarch 24th, 2009
Fix Youtube Videos from Overlapping Thickbox in Chrome and Safari
On CampusLIVE we have all the site logins prompt users with a thickbox. Recently we added a Youtube video to one of the pages on the site and it produced some problems in Safari and Chrome. The thickbox would come up, but was half covered by the Youtube video.
I tried altering the Z-Indexes of the modal thickbox and the video itself with no luck.
Here’s the fix. Just add wmode=”transparent” into the embed tag.
Published in: Web DevelopmentMarch 23rd, 2009
Virtualize all major web browsers for easy cross-browser testing
Anyone who has tried to test multiple flavours of Internet Explorer knowsthat it’s close to impossible to run multiple versions on the same machine. I came across a company called Xenocode that virtualizes all major browsers so that you can make one-click and run any major browser.
Just a few downloads and you’re off to the races:
IE6, IE7, IE8, Safari 3, Chrome, Firefox
Published in: Web DevelopmentNovember 19th, 2008
Show / Hide with Google Maps
For the new release of CampusLIVE we’re adding auto-geocoded maps using the GMaps api and a few custom php classes. We’re using the CodeIgniter framework, coupled with a custom version of the PhoogleMaps class (hacked into a custom CI library).
Our team agreed that we should hide the map under a “show/hide” link since most users wouldnt need to see them. Unfurtunately after placing the map in a hidden div and opening it up with a javascipt link the map would display half of the images and not work properly.
After a lot of thrashing the keyboard, I found the solution. Technically the gmap is drawn to the size of the parent block element. This means that when the map is inside a div with the style “display: none” initially, the map will not completely load. To fix this, use the “new GSize” function to override this and set the actual size of the map. Works great.
Original GMaps Code
var map = new GMap(document.getElementById("map_canvas"));
With Fix Fix (use GSize(width in px, height in px))
var map = new GMap(document.getElementById("map_canvas"),{size: new GSize(653,348)});
August 8th, 2008
Using htaccess to remove / redirect a folder in a url
At CampusLIVE, we completely overhauled our codebase which resulted in all of our urls in Google to incorrectly go to our homepage. Here’s an example along with the solution
The Goal
The goal was to redirect any request to CampusLIVE.com/home/(anything) to CampusLIVE.com/(anything) so that all links in Google would work again.
Example of Old Url
http://www.campuslive.com/home/umass/restaurants
Example of New Url
http://www.campuslive.com/umass/restaurants
The Solution
Open up you .htaccess file in any text editor. My code can be substituted to work with your domain/folders.
Options +FollowSymlinks RewriteEngine on RewriteRule ^home/(.*)$ http://www.campuslive.com/$1 [R=301,L]
Summary
The above code will successfully redirect permanently any requested to /home/(anything) to /(anything).By using the 301 redirect, you are telling the search engines to permanently use the new address.
Published in: Questions Answered, Web Development

