STUDENT INFORMATION PROCESSING BOARDSTUDENT INFORMATION PROCESSING BOARD
MIT offers many options for viewing and publishing material on the Web. This week, we will first answer an unrelated (but timely) question, and then explore two of MIT’s most frequently used Web servers, web.mit.edu and www.mit.edu.
Question: How can I check my e-mail over Spring Break?
Answer: The easiest way is to use http://webmail.mit.edu. This will work from anywhere in the world (except maybe China, which frequently blocks access to the mit.edu domain).
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. For personal home pages, you can access the same page through both servers. However, the same page has slightly different addresses between the servers. For a personal home page stored in the “www” directory in your Athena account, the addresses are:
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 the 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 Web site?
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 tries 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 the people who can view a page to MIT users and groups of MIT users. Unfortunately, a certificate-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 Web servers?
Answer: If you access a Web page 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 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 Web servers?
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, that 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 Web page. 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 that does this is taoyue.com. If you type in this URL, you will be automatically redirected to the MIT home page of Tao Yue ’04 (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 concerned 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 or 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 e-mail to firstname.lastname@example.org. We’ll try to answer you quickly, and we might address your question in our next column. Copies of each column and pointers to additional information will be posted on our Web site: http://www.mit.edu/~asksipb/.