Atom feed of this document
 
 
 

 5.4.1. Create Static Website

You may use your Cloud Files account to create a static website on the World Wide Web. First, you must CDN-enable a 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. Each of the pseudo-directories becomes a subdirectory in the website.

The page you set for X-Container-Meta-Web-Index becomes the index page for every subdirectory in your website; each of your pseudo-directories 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.

In the below instructions, you are directed to create a CNAME with your DNS Server (or name server). This is the domain name of your site (such as www.rackspace.com). Your CNAME is set up with your individual DNS Server, which is outside the scope of this documentation. Once you have your CNAME established, map your domain name to your Cloud Files CDN URL to get your site up and running on the Web.

Set up a Static Website

The following list gives the step-by-step instructions for setting up a Static Website.

  1. Upload your pages to a container.

  2. Set the index (or primary page) for your website by doing a POST to the header X-Container-Meta-Web-Index on your website's container. See the example below, but remember to change the X-Auth-Token to your Auth token. You must write your storage URL and the container name to properly point to the container (<storage URL><container name>)

    You get your Auth token when you authenticate your session. See the "Request" and "Response" paragraphs in Section 3.1: “Authentication” for details on how to get your Auth token.

  3. CDN-Enable your container. See Section 5.2.1: “CDN-Enable a Container” for details.

  4. Go to your domain host and set up a CNAME to your CDN URL. The CNAME is the domain or branded URL you use instead of the CDN URL. If you need to find your CDN URL (called cdn-uri), do a GET to cdn.clouddrive.com. See Section 5.1.1.1: “View CDN Container Details” for details.

  5. To view your website online, go to your CDN URL or your CNAME domain.

 

Example 5.25. Set up Static Web

  curl -X POST -H "X-Container-Meta-Web-Index: index.html" -H "X-Auth-Token: XXX" "https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_a55df/MyLibrary/        
            

Once your container is configured for Static Web and your domain host has your CNAME recorded, you will get the following results.

 

Example 5.26. Container Setup for Static Web Site

  container/index.html
  container/page2.html
  container/subdir/index.html
  container/subdir/pageX.html
            

In the results below, the user's CNAME is myhost, and the X-Container-Meta-Web-Index is set to index.html. The results on the right of the example are the pages that display in the Web browser.

 

Example 5.27. Static Web Site Enabled Container Results

  http://myhost                     Displays container/index.html
  http://myhost/page2.html          Displays container/page2.html
  http://myhost/subdir              Displays container/subdir/index.html
  http://myhost/subdir/             Displays container/subdir/index.html
  http://myhost/subdir/pageX.html   Displays container/subdir/pageX.html
             



loading table of contents...