Hosting a Website on the Rapid Access Cloud

Introduction

The Rapid Access Cloud provides immediate access to computing resources which can be used to render 3D graphics, analyze data, and prototype applications. It gives users a platform for developmental work (non-production environments), and can also help to showcase their work on a website set up within the cloud environment. This document will explain how.

Before You Begin

Make sure you have read our Basic Guide to learn how to get up and running on the Rapid Access Cloud. You will need to know how to create a key pair, security group, and instances, and how to allocate a Floating IP to your instance.

To follow along with the instructions below, make sure you have done the following:

  1. Created a SSH Key Pair.
  2. Configured a security group to allow all traffic on ports 80, 443, and 4000.
  3. Launched an Ubuntu 14.04 instance. The name of the instance or the type of flavor does not matter.
  4. Associated a Floating IP to your instance.

Hosting a Jekyll Site

Jekyll is a static website generator. In short, it enables you to create articles and blog posts in plain text, and compiles that text into a full website. It's entirely possible to install Jekyll onto your local workstation, but to make instructions easier, this document will describe how to install it on the Ubuntu 14.04 instance you created.

To begin, log in to your instance via SSH through a command prompt:

$ ssh -i /path/to/key ubuntu@

Once logged in, configure the instance to use Cybera's local “apt” proxy. This will make software packages download and install much quicker:

$ /usr/local/bin/localSUS
$ sudo apt-get update

Jekyll has a few prerequisite pieces of software. To install them, run:

$ sudo apt-add-repository -y ppa:brightbox/ruby-ng
$ sudo apt-get update
$ sudo apt-get install -y ruby2.3 ruby2.3-dev make

Next, install Jekyll:

$ sudo gem2.3 install bundler
$ sudo gem2.3 install jekyll

When this command finishes, Jekyll will be installed.

You can create a new Jekyll-based website by doing the following:

$ jekyll new mysite
$ cd mysite
$ jekyll serve -H 0.0.0.0

Now open a browser and visit http://:4000.

Running a website via “jekyll serve” is not practical. Instead, it's better to install an actual web server, like Apache, and serve the site through it. To do this, first install Apache:

$ sudo apt-get install apache2

Next, compile your Jekyll site into a set of static HTML files. Ensure you are still in the “mysite” directory and run:

$ jekyll build

The result will be a set of static HTML files in the “_site” directory. Copy these files to the “/var/www/html” directory by doing the following:

$ sudo cp -a _site/* /var/www/html/

Now visit the following address in your browser: here.

Using a Domain Name

Accessing your site via Dashboard. Find your domain in the dropdown list and click the Manage button:

Next, click on the Advanced DNS tab. You'll see a screen similar to this:

The first thing to do is to change the “parkingpage.namecheap.com.” value to match your domain name. In the above example, “parkingpage.namecheap.com.” is changed to “rapid-access.cloud.” Don't forget the “.” at the end.

You can also delete the “URL Redirect Record”.

Next, click on the “Add New Record” button. Choose “A Record” for the type, use “@” for the host, and use your Floating IP for the IP address. The end result will look similar to the this (the Floating IP is not shown):

Once these changes are in place on the dashboard, they must still propagate throughout the internet. This could take a few hours. You can check on the status in two different ways:

Enter http://your-domain.com in a browser. If you see your Jekyll site, then the changes are in effect.

Run “dig your-domain.com” on a command prompt and wait until you see your Floating IP as the result.

Hosting a WordPress Site

Jekyll is a quick and easy way to get a website up and running, but it does have limitations. For example, it might not be practical to have everyone log in to your instance via SSH and create articles and blog posts on the command line.

Another option to host a website is to use WordPress. WordPress is a popular and powerful free content management system. Setting it up is a little more involved than Jekyll; we'll lay out the steps here.

First, WordPress requires a MySQL database to store the site content. You can install MySQL on your instance by entering the following:

$ sudo apt-get install mysql-server

You will be prompted to enter an administrator password during the install. Choose a secure password.

Once MySQL is installed, you will need to create a database and user for WordPress. Do the following:

$ mysql -u root -p
mysql> create database wordpress;
mysql> create user wordpress@localhost identified by '';
mysql> grant all privileges on wordpress.* to wordpress@localhost;
mysql> flush privileges;
mysql> exit

Now that MySQL is installed, you can install WordPress:

$ sudo apt-get install wordpress

Once this has completed, the final step is to configure Apache.

First, open the file “/etc/apache2/sites-enabled/000-default.conf” with an editor such as “vi” or “nano”. Replace the contents of this file with the following:


ServerAdmin webmaster@localhost
ServerName 
ServerName localhost
DocumentRoot /usr/share/wordpress


Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all


Options FollowSymLinks
Order allow,deny
Allow from all


ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Second, create a file called “/etc/wordpress/config-.php” and add the following contents to it:

');
define('DB_HOST', 'localhost');
define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content');
?>

Third, restart Apache:

$ sudo service apache2 restart

Finally, open a web browser and go to your domain. You will be presented with a WordPress setup wizard. Once you've filled in the required information, you can begin using WordPress!

Backups

This document has shown you how to use the Rapid Access Cloud to deploy a website, but it has not covered all aspects of website administration, such as making off-site backups of your site. Procedures like this are outside the scope of this document, but we highly recommend getting this set up straight away.

Leave a Comment

Your email address will not be published. Required fields are marked *