Knowledge base Web Space Technical
We expect you to use web space for web pages and not general file storage, and we allow up to 1GB of storage. If you exceed 1GB we may charge for additional usage in whole 1GB chunks. Most web sites are much smaller and we encourage you to tidy up and delete old pages and files no longer needed.
Uploading pages by ftp
You access your web site using ftp (file transfer protocol). You can do this directly from some applications that allow design of web pages. If you need an ftp client for windows we suggest 3dftp which is shareware available from tucows, although most ftp clients work with no problems.
- The ftp host (the machine you connect to) is your web site name for which you have a suitable DNS entry, e.g. www.testing.me.uk. By default, a DNS entry is set up for the www subdomain of your domain which points to our web servers www-server.co.uk.
- The username you use (login name) is also the web site name, e.g. www.testing.me.uk. This can be any subdomain of an entry for which you have set a password, e.g. people typically make a password for the top level, e.g. testing.me.uk, but log in as www.testing.me.uk which places them in the www subdirectory automatically on login.
- The password is as you have set up with us for the domain. In the management pages you can add an FTP password for the domain or specific sub domains.
You then find that your web site is in the /www/ directory (assuming you used a www. subdomain as the login). If you have other subdomains, such as www2.testing.me.uk then these are in a /www2/ directory, and so on.
Uploading pages by rsync
You can also upload pages using rsync. Rsync is an application which can ensure the copy of your entire web site on your machine is transferred to the web server, but only sending the changes you have made, even if they are within the middle of a file. This is much more efficient than ftp. Rsync can also send changes and new files in a compressed format to further speed up the process. Typically you would maintain a local copy of your site, make any changes you need and view them locally, and when you are ready use a single rsync command to quickly transfer all changes to the live site.
- The host is the web site name for which you have a suitable DNS entry, e.g. www.testing.me.uk. By default, a DNS entry is set up for the www subdomain of your domain.
- The module is the site name for which a password is set, e.g. testing.me.uk. This is not normally the www subdomain unless you have made a separate password entry for it.
- The username is also the site name for which a password is set, e.g. testing.me.uk. This is not normally the www subdomain unless you have made a separate password entry for it.
- The password is as you have set up with us for the domain. In the management pages you can add an FTP password for the domain or specific sub domains. The same password applies for rsync.
Typically you add a password for web use of your domain at the top level and rsync the whole site under a www/ directory.
Note: you must log in using ftp at least once to create the necessary directory structure for your site, or any sub-sites (subdomains with their own password) as otherwise rsync will not work. This initial ftp creates the necessary top level directories and fake root environment for your scripts.
For example, if you are using linux and in your site home directory, use something like:-
rsync -az . firstname.lastname@example.org::testing.me.uk/www/
Special files and directories
You can create any files and directories in your /www/ directory. If you want to provide a web site just under your domain name, e.g. http://testing.me.uk/ then there are some restrictions on directories you can use - you cannot use bin, etc, lib, tmp, or usr. These are also unavailable as sub domains (e.g. you cannot have http://bin.testing.me.uk/. See below for redirection if you want http://testing.me.uk/ to redirect to http://www.testing.me.uk/
These restrictions are because the system creates a fake root environment for your scripts to use. This is set up automatically the first time you use ftp to access the site. Note that this is not set up by access using rsync. You should always log in using ftp at least once to create the directories otherwise rsync will not work.
In any directory, including the main /www/ directory, you can have an index (called index.html ). This is displayed if someone goes to the site or directory without specifying a file name. e.g. http://www.testing.me.uk/fred/ will access /www/fred/index.html on your web site.
You can have an index.html (normal web page index), or index.htm, or index.cgi, or index.gif. You can also use index.wml for WAP phone use.
Note that any subdomains for which you have DNS entries appear as directories in your web space. e.g. http://www2.testing.me.uk/ is the same as http://testing.me.uk/www2/ and is in the /www2/ directory. It is sensible to make links to other directories absolute (e.g. with http://www.testing.uk/, etc) so that viewing in different ways does not cause problems.
The file password.txt in any directory is also special - see passwords. The file errlog.txt in the top level directory is also special, see scripts. Files with an error number, e.g. 404, and .html, are also special, see custom error pages.
The directory called weblog is also special as it is used for web logs, see below.
Custom error pages
You can create your own customised error pages if you wish. Simply create a page that is the error number followed by .html, e.g. 404.html will be the page not found error page. This applies to any requests in the same or lower directories unless a lower directory also has a 404.html.
It is always recommended that you use the HTML escape sequences for any unusual characters, e.g. £ instead of using a pound sign directly. One reason for this is that the characters you use directly will depend on the character set you are using and may be different on different browsers, or simply missing. Using the escape sequence should always work if the character is available. However, if you do wish to use any direct character coding at all, the web server defines all text/* format files using character set UTF-8 which is widely supported by browsers.
Password protected areas
You can password protect any part of your web site by creating a file called password.txt in any directory.
If this exists then access to that directory and any other files and sub directories* require a username and password.
Include in the file a list of entries, one per line, with name:password . This lists the names and passwords allowed access. You can also include IP addresses, each on their own line, that will also be allowed without having to enter a username and password.
Users cannot access password.txt via a web page even if they correctly log in to access the directory.
The password.txt file protects every file and directory at and below that point, so you could have another password.txt file in a subdirectory. In this case the username and password used must be in both files to allow access, and so on for further sub directories.
You can access logs of all web access to your site. These are available as text files listing every access so you can perform your own analysis, and as a graphical summary. The logs are held for each month.
To set up web logging, follow these simple steps.
- Using ftp, create on your site a directory called weblog
- Using a browser, access any page on your site
- Using ftp you should see a file in the weblog directory named by the month, e.g. 2008-10 for October 2008
- You can download this file at any time for any month using ftp. You can also delete old months using ftp.
- You can also access the page via your web site, e.g. /weblog/2008-10 which will show you a graphical summary
- You can also access the web log selectively, e.g. /weblog/2008-10/01 where the part at the end (01 in that case) has to match either the start of the date or the start of the URL. This can be useful as very big monthly logs may be too big to produce a report within the time allowed for CGI scripts.
- If you want to stop other people accessing the logs via the web site, create a password.txt file in the weblog directory (see above).
You can create a weblog directory in any part of your site, and access to that part of the site is logged.
We aim to keep the logs for as long as practical, but it is recommended that you should download the previous months logs and store them yourself if you would like to retain a copy. You can download the raw log file using ftp. We currently remove old logs after one year.
Perl and cgi-bin scripts
You can upload any perl scripts to anywhere on your web site. You can make a cgi-bin directory if you like, but scripts can be included anywhere on your web site.
For perl, the script should start with #!/usr/bin/perl
Particularly for perl scripts uploaded from windows machines, please upload in ASCII mode not BINARY.
Within the script, the mail program used for sending mail is /usr/lib/sendmail . You should not use this with the -t argument (which find the From and To in the email) but use -f 'from-email-address' 'to-email-address' in place of the -t argument.
A simple mailer is available - see below.
There are various perl scripts available on the internet, and many books on the subject. You do not have access to php or mysql on the server, and you may have to change the use of sendmail as above.
Your scripts have access to the following environment variables :-
|QUERY_STRING||The query string (bit after the ? in the URI)|
|PATH_INFO||If after the script there is a / and more of a path then this is that path|
|PARAMS||The parameters (bit after a ; in the URI)|
|REQUEST_METHOD||PUT or GET|
|REQUEST_URI||The URI (web page) requested|
|HTTP_HOST||Host: header contents Your web site name|
|HTTP_AGENT||User-Agent: header contents The browser being used|
|CONTENT_TYPE||Content-type: header contents Used for form postings|
|CONTENT_LENGTH||Content-length: header contents Number of bytes in PUT file|
|SCRIPT_NAME||The name of the script being run|
|HTTP_COOKIE||Cookie: header contents|
|HTTP_FROM||From: header contents|
|HTTP_REFERER||Referer: header contents The page this link came from|
|REMOTE_USER||If a login was required, this is set to the user name|
|REMOTE_ADDR||The remote IP address. This could be an IP6 or IP4 address.|
The output from the script must include Content-Type: header and may include other headers then a blank line and the contents. The only exception is a redirection in which case it can just contain the Location: header.
If you have a file called errlog.txt in the top level, then any error output from any scripts on your site is appended to this file. This is useful for debugging.
Please let us have suggestions for any other improvements you would like to this system.
Simple form mailer script
A simple perl script (mailer.pl) can be placed anywhere in your site. You can then use that in a <FORM METHOD=POST ACTION="mailer.pl"> form, including any <INPUT...> tags you like. You should include - either as input fields or and hidden input fields values for -FROM (the from email address), -MAIL (the to email address), -NEXT (the page to show after posting the form). e.g. <INPUT TYPE=HIDDEN NAME=-NEXT VALUE="thanks.html">
The web server does not automatically produce a directory index, i.e. a list of files in a directory if there is no index page. However, it is simple to add a directory index to a directory using a simple script. If you load the following as index.html then it will produce a simple directory index for the directory it is in. Obviously a much more sophisticated script could be written with icons, and sub directories, and so on, and there may be such scripts available on the web in perl.
#!/bin/csh echo "Content-Type: text/html" echo "" echo "<HTML>" echo "<TITLE>$REQUEST_URI/</TITLE>" echo "<BODY BGCOLOR=#FFFFFF>" echo "<H1>Directory listing of $REQUEST_URI/</H1>" echo "<PRE>" foreach f (*) echo -n "<A HREF='$f'>*</A> " /bin/ls -ld "$f" end
Sometimes you want to redirect a page. E.g. http://testing.me.uk/ to http://www.testing.me.uk/
To do this create a file in the directory for the page you want to redirect by the name index.http
In this file include the text (in this case assuming we want to redirect to www.testing.me.uk) :-
with a blank line at the end (the blank line is important).
For the technically minded, the web server treats any page ending with the file extension http as a raw HTTP response, so you can include any HTTP headers in the file including customised error messages, etc.
An alternative, is to use a 'frame', this will keep the original URL in the address bar of the browser, and will load the website in to a 'frame'.
Here is the example html code to put in your index.html file: Right click and choose save as. you will want to edit the code for your own use.