Chapter 4. Website setup

Table of Contents

4.1. Hosting a web page using your own domain
4.2. Handling wildcard domains
4.3. Testing a new domain

Before you start this chapter

  1. Connect to your server over SFTP using FileZilla (see Chapter 3, Connecting to your server with FileZilla and SFTP).

Start up your web browser and enter the machine’s name in the location bar, e.g. http://example.vm.bytemark.co.uk. As you can see, your machine is already hosting a default page.

The procedure for replacing this default page with a new one is as follows.

  1. Create a simple HTML file named index.html. It has been assumed that it has been saved in the directory called My Documents/.

  2. Start up FileZilla and connect to your server.

  3. The file index.html should show up in the lower left-hand pane. In the right-hand pane the /srv/ directory will be shown.

  4. HTML files should be uploaded to the public/htdocs/ directory. This can be found by revealing the contents of srv/ by clicking the + to its left in the top-right hand pane.

  5. Now right-click on index.html in the lower left-hand pane, and select Upload from the menu. The file is uploaded to the htdocs/ directory on the server.

  6. Refresh your web browser to see the result.

Note

This example shows uploading a web page written in HTML, called index.html. This file could also be written in PHP, in which case the file should be called index.php.

4.1. Hosting a web page using your own domain

The previous section dealt with setting up a web page using the default domain associated with the machine. A Symbiosis system can host many domains without any extra configuration. This section deals with configuring a second domain.

It has been assumed that both your server is hosted at Bytemark, and that this second domain is using the Bytemark name servers. If this is not the case, then Section 17.1, “Example DNS records” sets out the DNS records needed for the following procedure to work.

For the purposes of this tutorial, the domain my-brilliant-site.com is being hosted on the machine example.vm.bytemark.co.uk.

  1. With FileZilla connected to the server, make sure the Remote site text field is pointed at the /srv/ directory a. Right click on the folder icon b.

  2. From the right-click menu select Create directory and in the Create directory popup enter /srv/my-brilliant-site.com.

  3. Click the OK button c to create the directory

  4. Repeat this step to complete the domain tree with the directories /srv/my-brilliant-site.com/public/ and /srv/my-brilliant-site.com/public/htdocs/

  5. Create another index.html file.

  6. Upload it as before, but this time into the htdocs/ directory in the my-brilliant-site.com/ directory tree.

Within a hour, the DNS records for my-brilliant-site.com will be generated and uploaded to the Bytemark domain name servers. Navigating to that site will then show our new index page.

At this point, the site will also be visible at both http://my-brilliant-site.com and http://www.my-brilliant-site.com. This is part of the Symbiosis setup; if different pages were required at www.my-brilliant-site.com, a separate directory tree should be created for www.my-brilliant-site.com, with a different content as needed.

4.2. Handling wildcard domains

As previously noted if there is a directory present upon the machine with the name /srv/my-brilliant-site.com/public/htdocs/ the contents of that directory will be served for both:

This assumes that the appropriate DNS entries have been set up for the domain, pointing both my-brilliant-site.com and www.my-brilliant-site.com at the primary IP address of the machine. If a wildcard DNS entry for the domain were pointed at the primary IP, then any prefix, including www. would be served from the same directory, for example web.my-brilliant-site.com and wonder.web.my-brilliant-site.com. The only additional step you’ll need to perform is to create the appropriate DNS entry, which is discussed in Section 17.2, “Adding a wild-card hostname record”.

If you wish to mandate a particular hostname for your sites that can be arranged via mod_rewrite as discussed in Section 14.6, “Redirecting to the preferred website domain”.

4.3. Testing a new domain

It is possible to test the content associated with a new domain before it has been registered or had any DNS configuration done. This is done using the testing prefix.

If your machine is not hosted at Bytemark, or your machine name does not end in bytemark.co.uk then a wild-card DNS record is needed for this to work. This is discussed in Section 17.2, “Adding a wild-card hostname record”.

For example, to view the site my-brilliant-site.com which is hosted on the machine example.vm.bytemark.co.uk, simply head to http://my-brilliant-site.com.testing.example.vm.bytemark.co.uk/.

This testing URL is immediately available following the upload of the index.html or index.php files.

Note that there is no www at the start of the testing URL.

Note

This facility does not play well with certain directives that can be used in Apache htaccess files, especially rewrite rules.