How to Create Web Pages
On our Unix systems, you can easily publish web pages. By putting them in a specific directory, they are automatically and immediately made available at the url 'http://www.cis.umassd.edu/~username/filename.html'.
You must first create a subdirectory in your home directory to will hold all your web files. This must be named 'web', or else the server will be unable to find your page. (In a terminal, the command is mkdir web
. From the Linux GUI file manager ("Nautilus"), use the File menu command New Folder.)
Then create your home page HTML file, calling it 'index.html', and save it in the 'web' directory. This is the default file the server will look for when given your username. (If you don't have a file named 'index.html', if someone goes to the web address 'http://www.cis.umassd.edu/~user/' the web server will generate a not-very-pretty index of the files in your web directory. 'index.htm' does not work without the 'l'.)
You can organize your web files into subdirectories under 'web'; the URLs to those files include the subdirectory names in the obvious way.
You must be careful to set the file permissions on index.html and any other files you're making available. The web server acts as a "nobody" user, so the files must be world-readable. In a terminal, use the command chmod a+r files
so that ls -l
shows the files' permissions as rw-r--r--
. In Nautilus, use File menu Show Properties, Permissions tab; the "others" line is the one we're interested in.
(Directories probably only need the "x" permissions on, for rwx--x--x
; the system defaults leave "x" on, so it should be OK. The "x" permission for a directory gives the right to use the directory name in the middle of a path, or to "cd" to the directory, so if the web server get the names of the files from your links or the default name "index.html", that's all it needs. If you want the web server to be able to generate a list of files in a directory for you, you have to let it read the directory, so you must give it "r" permissions: rwxr-xr-x
.)
Do not make anything world-writable (like rw-rw-rw-
).
To create a web page:
- Create the subdirectory:
$ mkdir web
- Create the file index.html.
- Set the permissions:
$ chmod a+r index.html
(and any other files)