User Tools

Site Tools


building_a_website_on_sdf

This is an old revision of the document!


Building a website on SDF

Creating your own websites can be fun and SDF gives webspace to all its validated users, so the moment you become validated you can begin creating your own websites straight away.

In this tutorial when text looks like “this” this means it's a command you can run in your shell, once you've logged into SDF.

Getting Started

mkhomepg - This command needs to be executed before you can start building your web pages. When you execute this program, it will create a directory in which you can put all your web files. This directory is sym-linked into your home directory, under the name html. (A sym-link is sort of like a shortcut in Microsoft Windows.)You will be prompted to select a URL for your website. This URL is what other internet users type into their web browser to view your web pages. If you're not an ARPA member then you may only use url's in the form of '“<your login>.freeshell.org”'. For instance, my web pages are stored at '“alterego.freeshell.org”'. If you're an ARPA member, there are many different domains you may use.

So first, run at your ($) prompt:

$ mkhomepg

Your First Page!

Creating your first page is SO easy! First you'll need to open a text editor. SDF has many text editors installed but new users to UNIX often find that “nano” is the easiest to work with.

nano ~/html/index.html - This command starts the nano text editor, creating a new file, called 'index.html' in your html directory.Once you've executed the command above. You'll notice that the terminal layout has changed. If you press keys on your keyboard you'll notice they appear in the “text buffer”. Write out the text below into this program.

  <html>
  <head>
  <title>My First Page!</title>
  </head>
  <body>
  <h1>My First Page!</h1>
  <p>This is my first html web page!</p>
  </body>
  </html>

Now that you have copied the text out into 'nano', you need to save the file. To do this, hold down the 'CTRL' key on your keyboard and whilst pressing that, press the letter x, and answer Y to the prompt to save, after which nano will exit.

Right, now, do you remember that URL you selected when you ran '“mkhomepg”'? Open a web browser and type that into the address bar. Hopefully, after a few seconds. You should see your very own web page!

More Pages

Okay, now that you have your first web page up, here are some Resources for Developing Your Website

An important thing: your website files need to be set to particular user permissions in order to be viewable by the world. When you add pages or subdirectories to your web site, the easiest way to make sure it will all continue to work is to remember, after you are done with your changes, to run the command

 mkhomepg -p

The -p flag sets appropriate permissions for your ~/html, ~/public_html directories on the cluster, and your ~/html/<username> directory on the The MetaArray.

Here are all the options for the mkhomepg command, which you can see by running it with the h flag:

 $ mkhomepg -h
usage:  mkhomepg            (initial setup)
        mkhomepg -p         (set appropriate file permissions)
        mkhomepg -a         (set or unset your custom URL)
        mkhomepg -d         (set or unset http://sdf.org/~peteyboy)
        mkhomepg -t         (toggles SDF cluster/MetaArray hosting)

Problems

The most important thing you need to have is patience. Sometimes updates when running mkhomepg -p may take a few hours to complete, sometimes they will occur almost immediately. By using the higher functions of your brain and patience you will solve a lot of the problems you may meet!

In case a page is not found on your site, the client may be forwarded to a page of sdf.org or redmartian, which can be confusing (but which is in fact completely reasonable, as all the domains belong to one entity). If you want to prevent this also for broken links, you have to set up error handler documents. Please consult the FAQ, "CAN I DEFINE MY OWN 403, 404 and 405 ERRORDOCUMENTS?" item for this!

Diagnose

One way to try to figure out what is going wrong when you HTTP requests are made to your site is to look at http access logs.

Finding Your Logs on the Main Cluster

If your site is hosted on sdf.org (you are an ARPA member) then you can grep inside the httpd log file in /var/log directory. For example:

$ grep abc123.sdf.org /var/log/httpd/*.log

Finding Your Logs on the Metaarray

If your site is hosted on ma.sdf.org (you are a MetaARPA member) then you can look inside the log file for your web site in /meta/log. For example:

$ less /meta/log/abc123.sdf.org

Finding Your Logs for VHOSTs

If your site is VHOSTed, then you can access your site's own log file by ssh-ing to the norge server using your {LOGNAME}@{VHOSTDOMAIN} with your normal LOGNAME password, then your log files are /var/log/nginx/{VHOSTDOMAIN} and /var/log/nginx/{VHOSTDOMAIN}.err. ex:

$ ssh peteyboy@irulecomputers.com
... (login stuff)
$ less /var/log/nginx/irulecomputers.com

More Help

For additional help, check the information in the FAQ page "What About the Access Logs, Statistics, and Quotas?"


Traditional link (using RCS): http://sdf.org/?tutorials/building_a_website ,v 1.8 2020/01/01 22:29:35 niro

building_a_website_on_sdf.1644347188.txt.gz · Last modified: 2022/02/08 19:06 by peteyboy