Amazon S3 Static Website Hosting

Sometimes you don’t need a full blown web hosting environment with MySQL, PHP and other dynamic components.  Sometimes you just need to host a static website.

We can host static websites on one of our normal servers and support quite a large number of hits, but sometimes you may need VERY high availability service.

Examples of this include:

  • Informational sites with links to many downloadable files requiring high bandwidth
  • A “micro site” that is being sent out to a large number of people simultaneously requiring a large number of concurrent connections.
  • Static file hosting, such as images.  For example, if you have a blog with a lot of images, you can host the main site on a normal PHP server and the images on a high power system.

This is where Amazon S3 Static website hosting comes in handy.

You simply create a “bucket” in S3, create the website endpoint, choose the “index” file such as “index.html”, upload your static website and add a CNAME pointing to the URL that is given to you in the S3 control panel.

Although it’s not too hard to set up this service, we can provide assistance in establishing the initial site and helping you setup a client to upload files into the web space.

One advantage we can offer is the ability to host your static website on Amazon and still have some dynamic capabilities such as email forms, entering form data into a MySQL database, etc.

Contact us for more information and a quote on setting it up.

Cherokee Web Server

indiankidI ran across a webserver called Cherokee a week or so ago while looking around for “light” alternatives to Apache on VPSes.  It looked pretty nice, so I downloaded it and compiled the latest version 0.99.9 and started it up.

The nicest thing, I think, about this server is the simple Web configuration UI (cherokee-admin).  When you start it, it generates a one time hashlike password that you then use to log into the web config.  From there, you can configure virtually (no pun intended) all aspects of the web server, including virtual hosts and many other settings.

The reason primarily for my use is serving up my static HTML sites and light PHP ones as well, light meaning minimal DB calls for things like contact form entry, single simple “SELECT * from where whatever = whatever” type querys with small recordsets and so on.  I moved about 20 of my customer sites to it and so far so good.  That is the level of confidence I had in Cherokee.  100% stable so far.

Compiling it from source may not be everyone’s cup of tea, but it really isn’t that difficult.

Here’s how I did it from a new VPS.

apt-get install nano htop build-essential mysql-server php5 php5-cgi php5-mcrypt php5-mysql gettext

This installs nano (a simple text editor), htop (top on steroids), build-essential which is a meta package containing necessary packages to compile crap, mysql, PHP, a few extensions and gettext which the ./configure told me it needed and I’m surprised it wasn’t part of the build-essential.

If this is a fresh ubuntu build, you’ll probably get a locales error… Use this to correct.

sudo locale-gen en_US.UTF-8
sudo /usr/sbin/update-locale LANG=en_US.UTF-8

Download the latest cherokee source.

Untar it and enter the folder.

Now run these commands, modify the paths to your liking.  This runs the pre-compile config, makes then installs it, it then copies the init script to that folder and changes the permissions to allow it to execute.

./configure –localstatedir=/var –prefix=/usr –sysconfdir=/etc –with-wwwroot=/var/www
make
make install
cp contrib/cherokee /etc/init.d/
chmod 755 /etc/init.d/cherokee

to Autostart the init script on boot… Run this…

update-rc.d -f cherokee defaults

That’s about it, read the documentation for specific information on features and have fun.  It is a VERY fast and light webserver that is very well suited for basic websites running on minimal memory VPSes.

Moving away from Windows & IIS (ASP) to Linux @ SliceHost

I have, for years, been developing web apps and so on using ASP (Classic) on IIS.  It’s a “fine” platform, but I have, over time, become weary of the Microsoft bloat that accompanies running a Windows Server… Especially in a colo/dedicated/VPS environment.

Over the last few months, since my major GoDaddy Windows Dedicated servers got hit by a worm or something, I’ve seriously started learning PHP with MySQL.  I used MySQL quite a bit with ASP and am quite familiar with it, but PHP experience was rather limited.  In the last few weeks, I’ve written a few things and ported a customer’s website over from an ASP CMS I wrote to PHP (still need to finish the CMS in PHP).  The site runs so much faster and I am now able to host it on my new Slice VPS that I setup earlier this month.  In 15 minutes or so, I can have an entire new Slice setup with Apache or Lighttpd and PHP/MySQL and, with a little tweaking and securing, have a server up and serving sites.   Can’t do that with Windows that quickly.

Slice is still running strong and I’m going to do my best to get ALL my ASP sites “ported” over to PHP over the next few months.  I’ve been using ASP/PHP cross reference sites like Design 215 and a few others and have been able to do things very quickly.  The database part was the only part I really needed to find good samples  for, but they aren’t even too hard once you use them a few times.

SliceHost has inspired me to really learn Linux and abandon the Microsoft OS, but there is still one caveat to Linux that I am very disappointed with.  There is not a single (that I’ve found), reasonably priced, multi-domain, domain level administratable email server with a nice webmail interface for users and administrative functions.

I know there are a ton of “pieces” that I can put together to get something like that, like Postfix, EXIM4, Dovecat, etc., but I just simply don’t have the time to wade through the massive pile of config files to get all those pieces working together in a nice secure and highly reliable fashion.

So, I am going to continue moving all my websites over to Linux/Apache/Lighttpd/PHP/MySQL and keep a small (30gb, 768mb RAM) Windows Virtual Dedicated server running with SmarterMail 5.x mail server on it. SmarterMail is probably one of the BEST email servers for a web hosting environment.  It is a snap to setup, backup and move to a new server if needed (Trust me, I know!). I already own an Enterprise license and am just waiting for one last very important domain to move off a temporary dedicated server before I move it to a new Windows VPS to serve the remainder of my customer’s email needs.  SliceHost isn’t a fully “managed” solution, but with the Slice Backup capability, you can have daily and weekly images made and restore to them quickly at anytime in case anything happens…

Mosso is good and is finally rectifying the Compute Cycle issue I mentioned previously,  I may keep them if I can break even with the few sites I still host on there, but their servers aren’t nearly as responsive as a VPS or Dedicated server probably due to the massively clustered setup they run.  I don’t really need individual site scalability… If a site has high requirements, I’ll just stick them on a new slice and charge the customer accordingly.  Most of my sites that would need to scale are WordPress Blogs and could easily handle being Digg’ed etc, by installing WP-Supercache.

Ultimately I plan on hosting all websites and blogs on Ubuntu 8.04 @ SliceHost and email on a Windows VPS @ GoDaddy (for now) until I find a Windows VPS provider as excellent as SliceHost is (hint hint to SliceHost)…

That’s all for now…

If anyone knows of any turn-key type mail servers that are free/inexpensive (< $500) for Linux please leave a comment.

Clark Connect Community Edition as a Gateway

I’ve always have used simple WiFi routers to be the “first device” connected to my network here at home.  Over the last year or two, I have been experimenting with SveaSoft Talisman Opensource Router Firmware, on my Buffalo WHR-HP-G54, as well as DD-WRT.  DD-WRT has been my favorite and seems the easiest to use firmware with the slickest interface.

But it just didn’t feel like “enough” protection.

Enter Clark Connect Community Edition 4.2

Clark Connect Community Edition, CCCE for simplification, is the free edition of this OS.  It is a Linux firewall based on Red Hat Linux and contains many excellent features to protect your network and give you services that only much more expensive solutions offer.

I grabbed one of my “old” Dell servers, an SC430 Dual Core machine that I’ve used for reviews here in the past and started install of the ISO I burned (~487mb).  To utilize the firewall “gateway” mode of the OS, I installed a second old 100mb NIC card to be the external WAN side and kept the faster GB NIC for “internal” use.

Installation was a breeze, as most are these days, and within 20-25 minutes, I had the core system up and running.  It took a little bit of configuration to get both cards recognized and to get my cable modem provider to reset the ARP table (by rebooting the cable modem) for the external WAN side to kick in.  I just put a ping from a commandline on the gateway and watched it.

Pings were replied to…

The console interface is limited and mostly allows you to do simple things like configure NICS, view a traffic monitor (IPTraf) and other minor things.  There is a relatively new “graphical” GUI that lets you see some more, but it is still mostly limited.

The best way to configure the gateway is by logging into the web interface.  The web interface can be accessed by the URL https://yourgwIP:81 and entering the root password you chose during installation.  Once in, virtually every feature can be configured, services started/stopped and a full statistical interface can be seen.  More stuff can be installed/configured from the commandline via SSH or direct console access.

As stated above, in my network, this CCCE gateway replaced my DD-WRT WiFi router as the “first device” connected to the internet.  I then plugged the internal LAN NIC into a 24 port gigabit switch and connected my nearby workstations to it.  For my “remote” WiFi devices like my Laptops and iDudette’s Mac Mini, I reconfigured the DD-WRT router to be an internal device on the network.

The CCCE machine become the primary DHCP server on the network and the DD-WRT provides a seperate subnet that is not routable directly to the CCCE. I may change this in the future to make sharing a bit easier between the two networks.

I also run a 4 node Meraki network directly off the CCCE gateway and now I can better control the bandwidth and service usage of possibly “unknown” people to limit torrenting and other “illegal” activities.

There is so much more I can say, but you gotta see it for yourself.  This is the simplest of all the linux firewalls I’ve tinkered around with, even those who aren’t familiar with all these things should be able to figure it out.

Clark Connect also has a subscription level which will give you more features within the gateway, like Exchange Connectors and so on, and online DNS and other services.  See their website for more.

Here is the feature list from the site.

ClarkConnect provides all the necessary software and tools required for an organization’s server needs.  The details of the following features are described below:

Gateway and DNS Services
To complement the ClarkConnect feature set, we offer a suite of services to help deploy, manage and maintain a ClarkConnect system:

* Gateway Services
* DNS Services

Firewall, Networking and Security
ClarkConnect provides several levels of security.  At the network level, the firewall restricts access to your systems and provides advanced features, including DMZ, 1-to-1 NAT and Port Forwarding.  At the protocol level, the Peer-to-Peer detection system lets you manage peer-to-peer file sharing usage.  At the application level, the Intrusion Detection and Intrusion Prevention systems provide another layer of defense against threats to your network.

Multi-WAN
With the Multi-WAN solution, you can connect two or more Internet connections to your ClarkConnect system.  The solution not only increases your available bandwidth, but also provides automatic network failover.

Bandwidth Management
Some applications are more important than others.  The Bandwidth Manager lets you prioritize network traffic — downloading the latest Windows updates will no longer interfere with your Voice-over-IP (VoIP) calls.

1-to-1 NAT – DMZ – Peer-to-Peer Management – Intrusion Detection – Intrusion Prevention – Multi-WAN / Dual WAN  – Bandwidth Management – DHCP Server – Caching DNS Server

VPN / Virtual Private Networks
With the PPTP VPN solution, you can use the built-in VPN client that comes with Microsoft Windows to connect remote desktops and laptops to your network.  There’s no need to purchase and install expensive third party software — the PPTP VPN solution works right out of the box.

VPN – Connecting Local Area Networks
If you need to securely connect two or more networks via the Internet, using our unique Managed/Dynamic VPN fits the bill.  The VPN solution not only makes connecting remote networks easy, but also more reliable.  This solution is based on the standard IPsec VPN protocol, so you can count on industry standard encryption and authentication technologies.

Web Proxy and Filtering
The Web Proxy server reduces bandwidth usage and speeds up web browsing.  In addition, the proxy can be configured with user authentication.  With authentication enabled, you can control and monitor access to the web.

Content Filter
Whether you are concerned about students accessing pornography or employees checking their personal webmail during office hours, the Content Filter provides a flexible way to enforce web usage policies for your network.

Banner Ad and Pop-up Blocker
If you find that banner ads and pop-ups are slowing down your network, you can enable the Banner Ad and Pop-Up Blocker to speed up web page loading times.

E-mail
ClarkConnect has integrated the same scalable and reliable POP/IMAP and SMTP servers used by large organizations.  Thanks to the open-source revolution, it is possible for a small business to enjoy an enterprise class e-mail system.

Webmail, Outlook and More
End users can access their e-mail using any number of standard e-mail clients.  Though Microsoft Outlook is the most popular way to access mail on a ClarkConnect server, you can also use the built-in Webmail module and other popular e-mail software packages.

Multiple Antispam Engines
Our server solution provides several different antispam techniques to maximize the spam detection effectiveness.  The antispam engines include the SpamAssassin, Dspam and Greylisting.

Affordable Antivirus Protection
Expensive antivirus solutions are a thing of the past.  The Antivirus solution not only detects viruses, but also phishing attempts.  In addition, both antispam and antivirus scanning can be configured in Mail Gateway Mode so you can protect existing mail servers (including Microsoft Exchange) on your network.

Groupware
The suite of groupware features allows your organization to share and manage information.  With the Microsoft Outlook connector, you can share Calendars, Contacts, Tasks Lists and Notes.  Whether you need a company calendar or a sales contact list for a few members of your staff, sharing information is simple and affordable.

Flexshare
The powerful Flexshare feature allows people in your organization to share files and helps bring out the value of of all the information in your organization.

Database and Web Server
Do you need to install a web-based application on your network?  ClarkConnect provides the LAMP application engine with easy-to-use web-based administration tools:

* Linux
* Apache Web Server
* MySQL Database
* PHP

File and Print Services
The ClarkConnect solution provides both an FTP and Windows/Samba file server solution.  These two file server modules coupled with Flexshare Groupware gives you a powerful tool for sharing files in your organization.

Backup, Backup, Backup
There are two kinds of people — those who have lost important data, and those who will lose important data.  Backup is often overlooked, but it is one of the most important tasks for any organization.  The comprehensive LAN Backup and Recovery solution provides all the necessary tools to protect against disasters.

Utilizing Akismet Spam Blocker in a PHP Contact Form

I have a contact form on my company’s website that I have had serious problems with in the past… The past being before I implemented Akismet into the code.

Akismet is a service provided by Automattic (the creators of WordPress) and is an excellent API based spam blocking system. I’ve been using it for quite a while on my blog and rogue spams hardly EVER make it into my comments. Probably somewhere in the neighborhood of only 1-2 out of thousands make it through.

I will post both the basic code for a contact form as well as the Akismet PHP5 Class (from Alex) and the include file I created to utilize the PHP5 Class.

Here is the basic form (named contact.php), with the PHP code on top, that I use.

<?php
if ($_SERVER[“REQUEST_METHOD”] == “POST”)
{
include ‘akismet.php’;

$to = “YOUR EMAIL ADDRESS“;
$subject = $_REQUEST[“Subject”];
$message = $_REQUEST[“Message”].”<BR><BR>”.$_REQUEST[“Phone”].”<BR>”.$_REQUEST[“URL”];
$from = $_REQUEST[“Email”];

$headers = ‘From:’.$from.”rn” .
‘X-Mailer: PHP/’ . phpversion() .”rn”.
‘Content-type: text/html’.”rn”.
‘Date: ‘.date(”r”).”rn”;

mail($to, $subject, $message, $headers);

echo “Message Sent!”;
die();
}
?>
<html>
<head>
<title>My Contact Form</title>
</head>
<body>

<form action=”contact.php” method=”POST”>
<table align=”left”>
<tr>
<td align=”right”>Your name:</td>
<td><input name=”Name” type=”text”></td>
</tr>
<tr>
<td align=”right”>Website:</td>
<td><input name=”URL” type=”text”></td>
</tr>
<tr>
<td align=”right”>Your email:</td>
<td><input name=”Email” type=”text”></td>
</tr>
<tr>
<td align=”right”>Subject:</td>
<td><input name=”Subject” type=”text”></td>
</tr>
<tr>
<td align=”right”>Message:</td>
<td><textarea name=”Message” style=”width: 224px; height: 83px”></textarea></td>
</tr>
<tr>
<td align=”right”>Your phone:</td>
<td><input name=”Phone” type=”text”>(Optional)</td>
</tr>

<tr>
<td> </td>
<td><input name=”Submit” type=”submit” value=”submit”></td>
</tr>
</table>
</form>

</body>
</html>

contact.php includes the code I created to use the Akismet PHP5 Class mentioned earlier.

Here is the code for the akismet.php. Be sure to change the $WebsiteURL variable to your website address and $APIKey variable to the API key you already have. If you do not have one, signup for a WordPress.com account and you can get one free.

<?php
//Akisment PHP5 Class from Alex (http://www.achingbrain.net/stuff/php/akismet)
include ‘Akismet.class.php’;

//ENTER YOUR API KEY ON THE LINE BELOW!
$APIKey = ‘YOUR_API_KEY‘;

//Enter your web site address below. This is used as a parameter in the API call to Akismet…
$WebsiteURL = ‘YOUR_WEBSITE_ADDRESS‘;

//Call to check for valid API Key…
$akismet = new Akismet($WebsiteURL, $APIKey);

//Check to see if your API key is valid, if not, it will tell you so and stop.

if($akismet->isKeyValid()) {}else{echo “Your API key is NOT valid!”;die();}

if ($_SERVER[“REQUEST_METHOD”] == “POST”) {

//CHANGE the $_REQUEST items to match your form field input element names

$akismet = new Akismet($WebsiteURL, $APIKey); //
$akismet->setCommentAuthor($_REQUEST[“Name”]);
$akismet->setCommentAuthorEmail($_REQUEST[“Email”]);
$akismet->setCommentAuthorURL($_REQUEST[“URL”]);
$akismet->setCommentContent($_REQUEST[“Message”]);
$akismet->setPermalink($_SERVER[“HTTP_REFERER”]);

//IF THE MESSAGE IS FOUND TO BE SPAM, A MESSAGE WILL BE DISPLAYED. Customize as needed.

if($akismet->isCommentSpam()) {
echo “For some reason, your message was flagged as a possible SPAM message.”;
die();
}
//IF THE MESSAGE MAKES IT TO THIS POINT, IT IS VALID AND THE SCRIPT THAT CALLED THIS
//FILE WILL CONTINUE PROCESSING THE INPUT ACCORDINGLY…

}
?>

Click here to download a ZIP of the three files used in this example.

If you have any questions, leave a comment here and I’ll do my best to answer in a timely manner…