UCLA Mathnet Login

How to Publish a Web Page


Here is a video demonstrating the instructions below.


Web files and presentation occur on the UNIX / Linux system. If you are already a UNIX user, you may skip this next section demonstrating how to connect to your UNIX account from Windows. To accomplish this, we set up a ‘sample’ user called Math User, username = mathuser. Once the page has been set up and published, this sample site could be accessed from http://www.math.ucla.edu/~mathuser - where after the '~' would be your username.

If you are a Windows user, you will need to connect to a UNIX system in order to proceed, there are two options that you can use either 'Xming' (a XWindows client) or 'PuTTY' (a SSH client). Both are included on standard issue Department of Mathematics Windows machines and can be used right away, otherwise they can be downloaded from their respective links. This document will not cover their installation and is currently only intended to provide a demonstration using the console (for Windows, this means using PuTTY).

From Windows, begin by launching PuTTY (generally found under 'All Programs' > 'SSH').

In this example, we will be connecting to julia.math.ucla.edu, which as been entered in the 'Host Name (or IP address)' field.

You would connect to your homedir server or a UNIX / Linux machine that you access regularly. After you connect, you will be prompted for your username and password to continue.

From here on, the instructions will be working from the console, even though the screenshots will be in PuTTY, the information will be the same for both Windows and UNIX users.

If this is your first web page at Mathnet, you probably don't have a 'public_html' directory, where your webpage files need to be. So we will begin by creating it and giving the webserver permission to hunt within it for files.

  1. Use the following commands to create the directory and give the webserver the necessary permissions: (pressing enter after each line)
    • cd $HOME
    • mkdir public_html
    • chmod 755 public_html
    • cd public_html
  2. Now you are in your 'public_html' directory where your webpage files can be placed.
  3. Copy a simple template page into your directory using:
    • cp -p /net/arachne/h1/www/htdocs/templates/homepage.html  index.html

    The '-p' switch keeps the original permission allowing the webserver to read the file, if you didn't include '-p' you can use: 'chmod 644 index.html' to reset the permissions.

  4. The page must be named index.html to be your home page.

Editing your Web Page

On Linux you can use your favorite file editor, such as vi or nano, to edit the new page. Nano is easier to use. You would do this by typing 'vi index.html' or 'nano index.html' to get started. To save and quit in nano, press CTRL+X, and follow the prompts to save your file.

If you are unfamiliar with editing html or using vi or nano, you can search for help with your favorite search engine.

You can also download/upload from/to your public_html folder using WinSCP (on Windows) or Filezilla (on Mac). Make sure your files have the appropriate permissions.

To improve the styling of your page, please refer to the W3C Wiki Page for general syntax and element references as well as Sitepoint's CSS reference.

Posting Solutions Online

If you decide to post solutions to homework problems (or quizzes or exams) online, it is probably a good idea to do so under some password protection. Not only may you want to limit the access to those solutions concurrently, but in particular for the future. The mathematics computing group has written a script which makes it very easy for you to create a password protected directory (see www.math.ucla.edu/computing/kb/password-policy).

How to password protect your web page using the command 'mkwebpass' on your UNIX account

• First, log in to your UNIX account. To do this, you will need to use Secure Shell SSH, or X-windows.

• Once you have logged in to your UNIX account, move (change) to the directory (where the web page is located) which you want to protect.

• Then, type the following: mkwebpass

• You will then be prompted to type in a username/password (please use ones that are 'different' from your UNIX username/password).

• This creates the .htaccessj.htpasswd file in the web page directory.

• If you want a different username/password combination, then simply re-run the command.

• If you want to remove the password protection, simply delete the files .htaccess and .htpasswd.