This article uses the new DreamObjects cluster of 'objects-us-east-1.dream.io'. If you have an older DreamObjects account and have not migrated your data yet, your hostname may need to point to 'objects-us-west-1.dream.io instead. Please review the following migration article for further details.
Static web pages are usually HTML pages instead of being dynamically built by a web application such as WordPress or framework such as Django. There are a lot of tools that help generate and maintain static web pages: the site StaticGen maintains a list of open source static site generators you can use to create the files to upload to your new DreamObjects website bucket.
This tutorial covers how to serve a static website from a DreamObjects bucket, but doesn’t cover how to create the files for the static website itself.
Make sure you have a working installation of S3cmd (version 1.6 or greater) before proceeding.
Creating the bucket
The name of the bucket must be the same name of the DNS entry for the website. For example, if your website is www.example.com, name the bucket www.example.com:
[[email protected]]$ s3cmd mb s3://www.example.com Bucket 's3://www.example.com/' created
Creating the website for the bucket
Once the bucket is created, use s3cmd to configure the bucket as a website. The option ws-create takes many arguments. In this example, the default index page is configured:
[[email protected]]$ s3cmd ws-create --ws-index index.html s3://www.example.com Bucket 's3://www.example.com/': website configuration created.
You can also configure a default error page, using the –ws-error argument for the ws-create command. Read the full S3cmd man page for more details.
Check the results of the command with ws-info — it should look like the following example:
[[email protected]]$ s3cmd ws-info s3://www.example.com Bucket s3://www.example.com/: Website configuration Website endpoint: http://www.example.com.objects-website-us-east-1.dream.io/ Index document: index.html Error document: None
s3cmd configuration needs website_endpoint set to output this value correctly. If you use the default, things will still work, but the printed output here will be http://www.example.com.s3-website-us-east-1.amazonaws.com/.
Setting the policy for the bucket and upload the static files
[[email protected]]$ s3cmd -Pr sync . s3://www.example.com
This process takes awhile, depending on the size of your site and the upload bandwidth. Once it completes, visit the website endpoint with your browser (in the example, http://www.example.com.objects-website-us-east-1.dream.io/). You should see the content of your index.html file.
Support for HTTPS will be added in the future.
Creating the DNS entry
As a last step, you can create a more attractive name for your site, such as www.example.com. Go to the (Panel > 'Domains' > 'Manage Domains') and add a custom DNS record to the domain. Pick CNAME and insert www.example.com.objects-website-us-east-1.dream.io.
The endpoint for website is objects-website-us-east-1.dream.io while the API endpoint for DreamObjects is objects-us-east-1.dream.io.
As soon as DNS information propagates, your site is reachable in your browser at http://www.example.com.