Cloud Journey: Serve A Static Website Fast, Without Servers

Filed in Cloud Industry Insights by Jerry Schwartz | February 21, 2013 12:00 pm

When thinking about overall website performance, speed is key. There are a lot of ways to improve your website and application speed.

One way to optimize your website is by making it static. With a Cloud Files[1] account, you can create a static website by using a CDN-enabled storage container. Your website can be hosted entirely from Cloud Files, without needing any servers. Hosting a static website on Cloud Files and the Akamai CDN gives your website incredibly quick load times and increases website reliability.

See It In Action

Rackspace’s Hart Hoover used this approach for the Rackspace DevOps blog[2], transitioning the site from Cloud Servers to Cloud Files. In his words, the solution was “stupid easy and extremely scalable.”

How To Implement

To create a static website using Cloud Files, start by creating a CDN-enabled storage container. Any HTML or static web pages in the container will become available through a static website once you set the X-Container-Meta-Web-Index header to index.html or other index page of your choice. You may also create subdirectories in your website by creating pseudo-directories, as outlined in the pseudo directory section of this guide.[3] Each pseudo-directory becomes a subdirectory in the website.

Note: The page you set for X-Container-Meta-Web-Index becomes the index page for every subdirectory in your website; each pseudo-directory should contain a file with that name. So, if you set X-Container-Meta-Web-Index to index.html, you should have an index.html page in each pseudo-directory. If you do not have the named index page, visits to myhost/subdir/ will return a 404 error.

  1. Upload your pages to a container.
  2. POST the X-Container-Meta-Web-Index on the storage container to set the index or other primary page of your website. You must write your storage URL and the container name to properly point to the container (<storage URL><container name>)
  3. CDN-enable your container.
  4. Go to your domain host and set up a CNAME to your CDN URL.

Have Questions?

Visit the Open Cloud Community[4], where we have set up a thread on this topic to answer any questions you have.

Endnotes:
  1. Cloud Files: http://www.rackspace.com/cloud/files/
  2. Rackspace DevOps blog: http://devops.rackspace.com/
  3. the pseudo directory section of this guide.: http://docs.rackspace.com/files/api/v1/cf-devguide/content/Pseudo-Hierarchical_Folders_Directories-d1e1580.html
  4. Open Cloud Community: https://community.rackspace.com/general/f/34/t/480

Source URL: http://www.rackspace.com/blog/cloud-journey-2/