Ask SIPB - March 21, 2003

MIT offers many options for viewing and publishing material on the web. This week, we will first answer an unrelated (but timely) question, and explore two of MIT's most frequently used web servers, web.mit.edu and www.mit.edu.

Question: How can I check my email over Spring Break?

Answer: The easiest way is to use http://webmail.mit.edu. This will work from anywhere in the world.

Question: What is the difference between web.mit.edu and www.mit.edu, and why do I have to care?

Answer: web.mit.edu is run by MIT Information Systems, while www.mit.edu is run by us (SIPB). They are approximately equally reliable, and (for personal homepages) you can access the same page through both servers. However, the same page has slightly different addresses between the servers. For a personal homepage stored in your Athena account, the addresses are:
http://web.mit.edu/yourname/www/
and
http://www.mit.edu/~yourname/
Athena lockers have the same pattern: for example http://web.mit.edu/6.170/www/ and http://www.mit.edu/~6.170/ are the same page of the class (and locker) 6.170. Many people prefer the "www" address because it is slightly shorter to type.

Other differences are that servers have different features (two of which are covered below), and web.mit.edu provides more bandwidth internally to MIT.

Question: Can I password protect part of my MIT website?

Answer: Yes. www.mit.edu and web.mit.edu offer two ways of restricting who can view a page.

www.mit.edu supports password protection, that is, anyone on the internet who knows the username and password can access a password-protected page. If someone trys to access the password-protected page via web.mit.edu, they will get "Forbidden". Accessing the same page via www.mit.edu, the browser will prompt for a username and password. The directions and caveats for setting up password protection are given at http://www.mit.edu/faq/password.html. An example password-protected page is http://www.mit.edu/~asksipb/password. The username is "foo" and the password is "bar".

web.mit.edu supports securing web pages with MIT certificates. You can restrict who the people who can view a page to MIT users and groups of MIT users. Unfortunately, a certficate-protected page cannot be viewed by someone without an MIT username. The directions for setting up certificate-protected pages are given at http://web.mit.edu/cwis/web/htaccess-usage.shtml.

Question: How can I set the MIME-type of a file I serve from the MIT webservers?

Answer: If you access a webpage through www.mit.edu, you can set the MIME types in a .htaccess file. On web.mit.edu, the web server sets the MIME type to a value that's usually correct, but there's no way to override it.

.htaccess is a short text file with a line beginning with AddType, then the MIME type, then has the filename extension. For example, suppose you wanted to use the MIME type image/jpeg for any filename ending with ".fire". The file .htaccess would have

AddType image/jpeg fire
This assigns the image/jpeg MIME type to any ".fire" files stored in same Athena directory as the .htaccess file, or stored in subdirectories below that directory. For more details, see http://www.mit.edu/faq/mimetypes.html. An example is shown at http://www.mit.edu/~asksipb/mime/. Note that the example does not work when the same page is accessed at http://web.mit.edu/asksipb/www/mime/

Question: How can I serve large files fast from the MIT webservers?

Answer: Use web.mit.edu if the intended audience is within MIT. For connections within campus, web.mit.edu has greater bandwidth than www.mit.edu. Note however, for people viewing from the outside world, both servers have the same bandwidth.

Question: Can I host my own domain (mycoolname.com) at MIT?

Answer: Sort of. For a price, you can have a domain be redirected to an MIT webpage. Note that you may not use any web server at MIT for running a business. (See http://web.mit.edu/cwis/faq/guidelines.html).

Google for "domain redirect" and you will find a variety of domain-registering companies supporting URL redirection (also called URL forwarding). Prices vary, but there are some registrars who provide domains and reliable URL redirection for $10/year.

Here's how it works. Someone types http://www.mycoolname.com/ in their web browser. The web request first goes to a web server that's operated by the registrar. Their web server sends a "redirect" to tell the browser to go to the new URL http://web.mit.edu/yourname/www/. The browser handles this automatically and displays the MIT-hosted web page.

An example page which does this is taoyue.com. If you type in this URL, you will be automatically redirected to Tao Yue's MIT homepage (thanks Tao!).

Question: How do I prevent web users from seeing the list of files in my home directory?

Answer: You may have discovered that anyone can list the files in your Athena home directory via http://web.mit.edu/yourname/. The contents of the files themselves won't be viewable, but the names will. If you are concerened about this, do
athena% touch ~/index.html
If you're especially concerned about someone seeing the names of the files in your home directory, you should move those files to your Private directory. Then, they won't even be listable even by someone who logs into Athena and looks in your home directory in AFS.

Question: Are SSI, CGI, PHP, or server logs available?

Answer: Both web.mit.edu and www.mit.edu support Server-Side Includes (SSI). This allows you to create .shtml files, which can specify some details of constructing a web page (e.g., pages that include a common header or footer).

The most commonly used CGI (Common Gateway Interface) program at MIT is the one for e-mail forms. You can design your own arbitrary forms -- a typical example is collecting names, addresses, and requests or problem reports. When someone clicks the "Submit" button, the information the person entered is e-mailed to you. For more details, see http://web.mit.edu/cwis/faq/forms.html.

Other CGI programs are listed at http://web.mit.edu/cwis/. For security reasons, neither web.mit.edu nor www.mit.edu, allow you to create your own CGI programs. The only CGI programs available are those the server administrators have installed.

PHP (a "hypertext preprocessor") is similar to SSI and CGI. Unfortunately, it is not available on web.mit.edu nor www.mit.edu.

If you have a computer at MIT, you may be able to run a web server that supports CGI, PHP, or corresponding Microsoft technologies such as ASP.NET. Web servers are allowed on student machines -- you probably want a static IP address (which dorm residents often don't have, but can get via http://rcc.mit.edu/). In MIT labs and offices, policies about web servers vary.

You can obtain limited information about visitors to your web.mit.edu and www.mit.edu web pages. For details, see http://web.mit.edu/is/help/web-reporting/.


To ask us a question, send email to sipb@mit.edu. We'll try to answer you quickly, and we can address your question in our next column. You can also stop by our office in W20-557 or call us at x3-7788 if you need help. Copies of each column and pointers to additional information are posted on our website: http://www.mit.edu/~asksipb/