May 19, 2008

First tasks

Press Spacebar to continue

First reading & discussion assignment.

Read and be prepared to discuss

Press Spacebar to continue

First Web assignment

Create one or more Web pages that will be served by the apache server on rosemary.umw.edu that accomplish the following tasks. If you create more than one page then make sure all the pages may be navigated in a direct and intuitive manner.

---- First assignment above this line (due tomorrow); Second below (due Thursday)

Press Spacebar to continue

Where do the source file(s) for your Web application go on rosemary.umw.edu?

What should permissions be?

Press Spacebar to continue

Putting Information on the Web

In order for information to be accessible through the World Wide Web, it has to be placed on a computer system that is running http (hypertext transfer protocol) server software. One place to read more about how a Web server works is How Web Servers Work by Marshall Brain, http://www.howstuffworks.com/web-server.htm.

One such computer system available for you to use with this course has the Internet domain name rosemary.umw.edu henceforth referred to as rosemary. The server software is Apache, an open-source, free, and the Web server most commonly in use.

Where to put your files

The configuration file is set so that the server may access files (and thus make them available on the Web) from a specific immediate subdirectory of any user's home directory. The name of that directory is public_html. The common Unix notation for this is ~/public_html with the ~ in this case indicating the user's home directory. Note that this isn't the URL for a file on the server.

The URL includes the login name for a user as described here. If a user with login name mwashing has a file named greatone.html, for example, that is located in the subdirectory public_html then the URL for that file is http://rosemary.umw.edu/~mwashing/greatone.html. Furthermore, only the files contained in public_html are accessible by the Web server.

http://rosemary.umw.edu/~mwashing/greatone.html


You can see from this that in order for you to make information available through the Web server on paprika that you must be a registered user of that computer system, i.e. have a login name and password, and you need to create a directory named public_html (use mkdir public_html) in your home directory after connecting to paprika through ssh and secure FTP

You can work on paprika as you would on any text based system through ssh. If you'd rather prepare files on another computer and upload them to paprika then use a secure version of ftp. rosemary is set so the access permissions are set correctly when you transfer files through sftp or create them using an editor.

Access file permissions

You may have to adjust access file permissions on a file you create on or transfer to paprika. All files available on through the Web server on paprika have to have have read access set so any user on paprika may read them. Here's why:

When a client requests a file from the server using a URL such as http://rosemary.umw.edu/~mwashing/greatone.html, the server software will attempt to transfer the file to the client. In order to transfer the file, access privileges have to be set so the file can be copied by the server. Each executing processes is associated with a user, and common sense security dictates that the executing server software (or any software that's open to the public without restriction) should be associated with a user with no special privileges. So since the server software has to be able to read the file requested, and since the software has no special access privileges, we have to give read access to all users on every file that we want to be available on the Web.

		chmod a+r greatone.html (if you're accessing the host system using ssh)

chmod 644 greatone.html (If you're using ftp)
You're using the program named chmod. Writing chmod a+r filename grants read access to all users of the computer system. You may also use a numeric scheme for setting access permission, and you have to use it if you're using ftp. Take a look at chmod tutorial for more information and practice.
		chmod a+r *
  
		find . -exec chmod a+r {} \; 

There is one more point.

The directory that holds the files have to be browsable by anyone. In Unix/Linux that means the access permissions for a directory have to set so any user has execute permission for that directory. You can set the the permissions for $HOME/public_html (your Web space) and all its files and subdirectories by entering:

	chmod -R a+rx $HOME/public_html
  

Checklist for putting information on the Web

Press Spacebar to continue

Lab Exercise

Go to B13. Log in and then open a terminal window.

Connect to rosemary.umw.edu using

ssh -X -C rosemary.umw.edu

Create a directory public_html in your home directory (if public_html doesn't already exist.) Copy all the files in /users/ernie/public_html/470S/lab1 to your public_html directory.

cp /users/ernie/public_html/470S/lab1/* $HOME/public_html

Set permissions so all files in public_html are readable by all, and thus may be viewed through an http request.

chmod -R a+rx $HOME/public_html

Open a browser and view the file with URL http://rosemary.umw.edu/~yourUserName/activity9p1.html

Now use vim or gvim to edit the source, $HOME/public_html/activity9p1.html, so it is about you, not me.

After you make some changes, save the source file, and then view it with a browser.

 

 

Press Spacebar to continue

Where to learn more

Press Spacebar to continue


Creative Commons License
This work is licensed under a Creative Commons License.
Ernest Ackermann Department of Computer Science, Mary Washington College
CPSC 401 | CPSC 470S

Bibliographic Information: