Uploading and Publishing Your Own Web Site on the Users Web Server

Students and staff in the School of Computer Science & Informatics, can upload and publish their own websites on the School's users Web server. The information here will tell you how to create the website, how to upload or remove pages, and how to write and install CGI programs. It also tells you how to publish your site so that it can be viewed on the World Wide Web.

Staff and students in Cardiff School of Computer Science & Informatics can create and publish a website on the School's users web server https://users.cs.cf.ac.uk/. Use of the users website is purely voluntary — it is not necessary for your work within the School. You decide whether or not to create pages for the server and whether or not to publish them on the World Wide Web. Web projects and other work for your course modules in the School should be installed on the the School's project web server (see Creating a Web site on the School's Project Web Server).

Setting up a Web Site

There are a few steps for setting up a website.

  1. Upload files to your site through the School's website upload file server websites.cs.cf.ac.uk.
  2. Visit https://users.cs.cf.ac.uk/ and publish your website.
  3. Browse to https://users.cs.cf.ac.uk/MailName (where MailName is your mail name) to see your website.

Uploading your Pages

In order to create your users website, you will first need to upload files to it - HTML files, PHP script files or CGI scripts.

You can upload pages through the School's website upload server websites.cs.cf.ac.uk.

For further details on uploading files please refer to:

Publishing your Web Site

Even after upload, your website is not available for viewing until you publish it. Publishing your site will list it in the users website index page and make its URL available to the Internet.

Open the URL , and you will see the index page where all of the users websites are listed.

In the left-side menu, notice the entry Publish your site. Click on this to begin the process of making your site visible.

You will need to authenticate to get to the Publish Your Site page. On the page, enter your password again and click the Authorise button. This will publish your pages on the users site.

When you click on the Authorise button, you agree to abide by the rules that apply to the users server. Your mail name will appear on the users index page and your website will be accessible over the World Wide Web. It is your responsibility to ensure that the pages you publish are proper and lawful.

After a few minutes, your mail name will appear as a link on the index page.

Hiding your documents

You can unpublish your website and hide your documents from browsers in the Internet. Click on Unpublish your site in the left-side menu to go to the Unpublish Your Site web page.

The files will remain in place, however, and you can still upload or delete them using the website administration program, or through websites.cs.cf.ac.uk by STFP or CIFS/SMB.

Accessing your Web Site

Once you have created and uploaded your site, and published it and made it visible on the Internet, you can view your site at https://users.cs.cf.ac.uk/MailName (where MailName is your University or Computer Science mail name).

Rules for pages on the users server

Publishing on the users website is a privilege offered to users within Computer Science & Informatics and it is your duty to treat this privilege responsibly and ethically.

Pages on the users server are visible to the whole Internet and are subject to School Rules, University Regulations, the Regulations of the University's Internet Provider (JISC), and legal restrictions regarding the propriety of their content. The Rules and Regulations include:

You must not publish copyright material or material that is otherwise restricted.
You must not publish material which might bring yourself, the School of Computer Science & Informatics or Cardiff University into disrepute.
You must not purport to be anyone other than who you are on your web pages.
Respect the privacy of others. Avoid material about private individuals unless you have their permission.
Think carefully before publishing material about real events. Try not to write anything that could be distressing to others.
Take complaints about material on your web pages seriously. Respond to complainants quickly and politely. Be prepared to remove material if you cannot achieve a resolution of the complaint.
You must not install pages or software which damage the security or integrity of the web server or University network. Keep security in mind when writing web pages and applications. Take care when installing third-party applications in your website.

Pages that are considered to be inappropriate by the Head of School or his designated web masters will be removed without appeal.

If you wish to create web pages that you don't want published on the Internet, use the project server instead of the users server. The project server is visible from within the School's Intranet only - see Creating a Web site on the School's Project Web Server.

Types of Web Page - Documents and Scripts

We can consider pages on a web server to be in four categories.

Simple document pages

Files containing HTML text, images, etc which are formatted and displayed by the client browser (such as Firefox, Google chrome, Konqueror, Safari or Internet Explorer). You may write such documents directly - in a simple text editor, for example - or you may use a web authoring program. On the server, HTML files are named something.html.

Scripted Web pages

Pages generated on the fly by the server. The server understands the PHP scripting language (see https://www.php.net). When you write a page in PHP, the server executes the contents of the page and produces HTML which it sends to the browser. Again, you can write these yourself or use an authoring package to create them. PHP files are named something.php. The file often consists of portions of HTML and PHP mixed together. Any PHP program portions in the file must begin with <?php and end with ?>. Raw HTML portions are sent to the browser literally, as if they came from a .html file.

Common Gateway Interface (CGI) Scripts

Linux programs which produce HTML (in general) as their output when they run. These may be written in any computer language available on the Linux server (e.g. Perl, Shell, C, Java etc). CGI scripts follow a special protocol. In particular, the first thing they output must by a header which defines the sort of output that will be produced. CGI scripts should be placed in directory cgi-bin, or sub-directories of it, within your web file space and the file must be executable.

Other Pages

If a file is not a .html or .php one, and it's not a CGI script in cgi-bin, then the server will usually send the contents of the file to the browser unchanged. The file name is passed to the browser and it uses this to decide how to display or save the file. For example, the server may send PDF files, MS Word documents, PostScript files etc. Web browsers are often equipped to deal with these. Sometimes a browser has built-in functions to handle a non-HTML page, or it may run a so-called plugin or external application, or it may simply save the file onto the local computer.

An Example HTML Index Page

Here is an example of an simple HTML file and the web page it produces.

<title>My first document</title>
<h1>A heading</h1><p>Text can be plain, <strong>bold</strong> or <code>italic</code>. There can be images included</p>
<p><img src="/image/y_ddraig_goch.gif" /></p>
<p>and links to other pages like <a href="https://users.cs.cf.ac.uk/">here</a> to the main user-supplied pages.</p>

Preventing listing of directory contents

When you visit directory in your site, the browser will list the contents of the directory.

This is generally undesirable. It's better to have a file called index.html or index.php in your website's directory. A file with one of these names will be displayed by default when the address that's requested is a website directory.

So, if the user above renamed file first.html as index.html, the simple html file would be displayed by default and no directory listing would appear. You can rename files using the website administration program, or an STFP or CIFS/SMB application.

Secure mode

The users server also has a secure HTTPS mode which you can use, for instance, if you want the browser to send passwords or other valuable data to the server. Secure URLs are the same as ordinary ones but with https: in place of http:.

Running CGI scripts

Executable files in the cgi-bin directory in your web file space can be accessed using URLs of the form https://users.cs.cf.ac.uk/MailName/cgi-bin/ followed by the file name, where MailName is your University mail name.

There is a maximum CPU time allocated to scripts executing on the users server. After this has been reached, the program is terminated. Any HTML which it has produced is flushed to the client browser but no error message or indication of termination is given.

Reading and Writing Files

CGI scripts and scripted web pages can access files in the Linux file system on the users server. If you want your script or page to access a file called site.log, say, in your website directory, you can specify the full pathname of the file as /usr/local/www/user/MailName/site.log, where MailName is your University mail name.

This pathname is the name of the file in the Linux Domain. This means that the web server looks on its local file system for the file.

Note that files in /usr/local/www/user/MailName/ are accessible to web users using a Web Domain address starting https://users.cs.cf.ac.uk/MailName/.

If you don't want people to see the file, you will need to protect it with a .htaccess file. One way to do this is to create a separate directory for files which are used directly by scripts and pages that is protected the directory against web access.

Use the website administration program, STFP or CIFS/SMB application to create a directory called files, say, so that the Linux Domain path for the file would be /usr/local/www/user/MailName/files/site.log. Now create an access control file called .htaccess in the files directory. The access control file should contain:

order deny allow
deny from all

This will prevent any files in the directory from being accessed over the Web but won't stop your pages or scripts from accessing them in the Linux Domain.

Referring to Other Documents

When your pages refer to other documents on the users server, for example in a HREF link or an IMG specification, it is better to use a relative URL rather than an absolute one. So, you can (and should) miss out the https://users.cs.cf.ac.uk part because the server will automatically fill in its own address.

Similarly, you can miss out the directory hierarchy if the document you want is in the same directory as the one being read. So, to refer to a page other.html in your website directory from your index page, use the URL other.html instead of https://users.cs.cf.ac.uk/MailName/other.html.

Use the full URL if you are referring to an external page on another server. For example use https://docs.cs.cf.ac.uk/ to refer to the home page on the School's Documentaion and Facilities website.

Server-side Includes

It is possible to include directives inside your documents which cause a program to be run on the server. This is similar to using a CGI script except that the HTML it outputs is included in the document being displayed instead of creating a separate web page.

The program or script to be run can be in your cgi-bin directory, or other accessible document directory.

For example, suppose you want to include the CGI script count.cgi which is in your cgi-bin directory. Put the following directive in your document.

<!--#exec cgi="cgi-bin/count.cgi"-->

The server will not look for the directive unless the document file access modes are set to be executable. (This is for performance reasons, it prevents the web server from scanning files unnecessarily). You can set the mode using the website administration program.