Omega

Omega -- Setting up Your Website



   Setting up a website on Omega is extremely easy. All you need to do is create a directory called public_html inside your home directory, and copy all website related files into it or its subdirectories. There is a set of filenames that the Apache web server will read and send automatically when the web browser requests a directory (such as http://omega.cs.iit.edu/~<username> or http://omega.cs.iit.edu/~<username>/projects/). This list is, in order: index.html, index.shtml, index.php, and index.jsp. You should thus use of those as your introductory page's filename -- it will be the one loaded and displayed when someone asks for your website for the first time. It is also generally a good idea to have at least one "index" file in every one of your directories.

<username>@omega /somewhere $ cd ~
<username>@omega ~ $ mkdir public_html
<username>@omega ~ $ cd public_html
<username>@omega ~/public_html $ joe index.html
One issue you will have to deal with is setting correct permissions on files and directories you make available on the web. Fortunately, you will usually only have to set these when you first create your website - a default, sufficient set of permissions will be used from then on, and you will have to modify it only for executable CGI scripts and certain directories.

The following are the general guidelines:

  • All public_html subdirectories should have their permissions set to 711.
  • All CGI scripts (files ending with .pl or .cgi) should have their permissions set to 755.
  • All other files, including PHP, HTML and image files, should have their permissions set to 644.
The 711 set of permissions on directories looks like drwx--x--x in ls -la's output. It tells the operating system that you, the owner, can read files from the directory, write files to the directory, and freely view its contents; everyone else, however, can read files from the directory only if they know the filenames. The 755 set of permissions on CGI scripts looks like -rwxr-xr-x, and gives you the permission to read, write, and execute the file, while limiting everyone else to only reading and executing. Finally, the 644 set of permissions on regular files looks like -rw-r--r-- and, as you may have guessed, allows you to read and write to them (no point in executing non-executable files), and everyone else to read them only. After creating files and directories, it's a good idea to make sure these permissions are really set. If they are not, you can execute one of the following commands to fix the problem:

<username>@omega ~/public_html $ chmod 711 directory
<username>@omega ~/public_html $ chmod 755 cgi.pl
<username>@omega ~/public_html $ chmod 644 index.php
One last thing, and probably the most important one, concerns the public_html directory itself. If you'd like to prevent other Omega users from seeing your files (including those containing actual source code, such as Perl and PHP scripts) as they sit on the server (as opposed to only after they were processed by the web server and displayed in a web browser), you will need to change the group ownership and some of the permissions of the directory. Remember, if you are working on a class assignment, you are responsible to follow this step and prevent your classmates from obtaining your work! In order to do so, issue the following commands:

<username>@omega ~ $ chweb public_html
<username>@omega ~ $ chmod 710 public_html
   If you'd like to use Java Servlets and JSPs on your website, a Context will have to be created for you within Tomcat's configuration file. Go to the Create a Tomcat Web Application page to create one. If you decide to place your JSPs and servlets in public_html, the permissions on your public_html directory and on the WEB-INF directory need to be 750 instead of 710.

   Once everything is set up, you can either write your web pages directly on Omega using a text editor (like joe), put them together on your desktop and upload them to Omega using WinSCP (see the Connect HOWTO for details), or map your home directory using Samba and access your files directly (the Connect HOWTO will help you with this, as well).

   Simple tutorial for how to use Apache's .htaccess files is at http://httpd.apache.org/docs/howto/htaccess.html. If you'd like to password protect your pages, read this tutorial.