Web publishing introduction
This page describes, step by step, how to set up a web page in AFS that is served by the main SCS web servers. The specific example used will be that of user "bovik" who is setting up a home page that will be accessible via the URL: http://www.cs.cmu.edu/~bovik. You can substitute your own SCS userid for "bovik" when carrying out these instructions. In this example, it is assumed that no special access restrictions are needed for these web pages (i.e. they will be available to anyone on the internet).
Access to a Linux command shell is required in order to follow these steps. The easiest way to get such access is to SSH to our general purpose Linux computer that you should have received an account on when you got your initial SCS account.
- Create a directory where the web files will be located
- Set the AFS ACL for this directory
- Create the web pages.
- Create a .htaccess file
- Request a shortcut URL for the pages
- Adding your web page to your record in the SCS People Directory
A standard place to put web files is in a directory called "www" in the top-level of one's AFS home directory. To create such a directory, use the mkdir command. For example:
Use your own SCS username in place of "bovik" in the example above. If you receive a "Permission denied" error, you may not have AFS tokens. Type kinit, type your SCS Kerberos password at the prompt, and try again.
You will need to set the AFS access control list for this directory so that the web servers can access it. You should do this before creating any subdirectories, since AFS ACLs are inherited from the parent directory (this will save you work, later). To set the AFS ACL, use the fs sa command. For example:
fs sa /afs/cs/user/bovik/www wwwsrv:http-ftp rl
As before, substitute your own SCS username in place of "bovik". "wwwsrv:http-ftp" is a special AFS group that contains the IP addresses of the main SCS Web servers (along with a few other hosts).
By default, your top-level AFS directory (e.g. /afs/cs/user/bovik) will probably not have a sufficiently permissive access list to allow the SCS Web servers to get access to the www subdirectory. You should type the following command to ensure that the web servers will be able to access that directory:
fs sa /afs/cs/user/bovik wwwsrv:http-ftp l
Note that we are just giving "l" permission, not "rl" permission in this case. See our documentation on AFS permissions and their meanings for additional information about what these permissions do.
You should create a page in the www directory called "index.html". This will be the "index page" for that directory. You can then create other web pages in the directory that index.html links to. If you are editing pages under Unix, the recommended text editor is emacs, You can also edit the pages on another host, such as a PC, and then transfer the files from the PC to your AFS space by using sftp, scp or ssh or by directly using the PC's native AFS client (which is installed on Facilitized PCs).
A file called .htaccess must exist in your www directory in order for the web servers to serve the files in it. Use a text editor on the Unix host (or copy files from another machine) to create this file. It should have the following contents:
order deny,allow allow from all
See our documentation on .htaccess files for additional information on this file, and how to customize it.
At this point, your web page should be accessible via the URL:
The next step is to make a shortcut URL, so the page is visible via the URL:
In order to access your web page with a "~username" URL, please send an email to email@example.com. In your email, be sure to include your SCS username and the folder in AFS where your ~username URL should point. After the Help Desk makes this change, it will take a few hours for this change to take effect, after which your web page should be accessible via the URL:
In order for your page to appear as part of your record in the SCS People Directory, people.cs.cmu.edu, you will need to submit your URL to Human Resources via the HR Connection web site, http://www.cmu.edu/hr/benefits/hr_connection.html . Once logged in, follow the instructions to change your demographic information. Your URL should appear in the SCS People directory in a day or two.