National University Of Singapore
IC368 System Programming
Project Report
A Virtual Web Server and a Chinese Display Enabled Browser
Presented by:
Wang Hao
Table of Contents
1. Introduction
2. Configuration
2.1 Named configuration
2.2 Httpd configuration
2.3 Netscape and X Display configuration
3. Testing
4. Conclusion
5. Appendix
1. Introduction
This project establishes a virtual web server with Chinese character display enabled in the Netscape© Browser.
To set up a World Wide Web (WWW) server, I installed the Apache HTTP daemon. I configured the httpd configuration file httpd.conf to define a web site www.iscs.nus.sg. Correspondingly, I created the document root directory for this web site and put some document pages inside.
Since the httpd requires the presence of a name server to resolve the host names, I also configured my Linux machine as a primary domain name server (DNS). To do this, I installed the name server daemon (named) and configured /etc/resolv.conf and /etc/named.boot files. I also created several database files that match the hosts names to IP addresses, and vice versa.
Normally a WWW server is dedicated to processing HTTP requests for a single WWW site. In short, one WWW site per machine. Since the computing resources for processing httpd requests is low for most WWW sites, the majority of the computing resources are left unused. A virtual WWW site simply allows more than one WWW site to share a single processor. In my case, the web server locates two sites, www iscs.nus.sg and www.facai.com.
To configure a virtual web server, simply add a VirtualHost command and some parameters in httpd.conf , and create the document root directory for this virtual host.
Netscape 3.0 is installed into X window to facilitate WWW browsing.
Sometimes users may want to read some non-English based information on the WWW. Then comes in the need for enabling non-English character display on the browser. Here I arbitrarily choose Chinese as an example.
In X window, it is NOT the X application’s responsibility to get fonts. Instead, it is the X display servers’ duty. The XFree86 Linux package has already included the Chinese font library. Just execute the mkfontdir command to put the the library path into the fonts.dir which the X display server will read at start-up.
Here is a graphic view of how components (Netscape, httpd, named, X display) are related.
2.1 Configuration -- Named
Step 1. Install named.
Step 2. Edit /etc/resolve.conf. Add an entry
nameserver localhost.
This line declares the machine itself as a name server. Any host name resolve request will be sent to the local machine.
Step 3. Configure /etc/named.boot, the configuration file for named.
Declare /etc/named.hosts to store the matching from host names *.iscs.nus.sg. to IP addresses.
Declare /etc/named.rev to store the matching from IP address *.90.132.137 to host/network names.
Declare /etc/named.local to resolve the matching from localhost to 127.0.0.1
Declare /etc/named.facai to store the matching from host names *.facai.com. to IP addresses.
Step 4. Add records in /etc/named.hosts. One record is useful for httpd. That is www IN A 137.132.90.26
This matches www.iscs.nus.sg to the IP of the local machine.
Step 5. Add records in /etc/named.facai. One record is useful for httpd. That is
www IN A 137.132.90.26
This matches www.facai.com. to the IP of the local machine.
Step 6. Add records in /etc/named.rev and /etc/named.local.
( The details of the above files are available in the Appendix.)
2.2 Configuration -- httpd
Step 1. Install httpd.
Step 2. Edit /etc/httpd/conf/httpd.conf, the configuration file for httpd.
Declare the sever name as www.iscs.nus.sg
Step 3. Add a VirtualHost command in httpd.conf.
<VirtualHost www.facai.com>
ServerAdmin [email protected]
DocumentRoot /home/facai/html
ServerName www.facai.com
ErrorLog logs/errors.facai
TransferLog logs/access_log.facai
Step 4. Create /home/facai/html directory.
2.3 Configuration -- Netscape and X Display
Step 1. Download the Netscape 3.0 from our department Linux machine. Install it.
Step 2. cd /usr/lib/X11/fonts/misc. Here are a rich set of language font libraries
ls -l gb*.pcf.*. Verify that Chinese GB libraries are there.
mkfontdir Update font.dir. X Display reads fonts.dir files found it
its fontpath when it starts up.
3 Testing
Download the Lian He Zao Bao (Singapore Chinese newspaper) from the Internet and put into user wanghao’s directory. Use Netscape to browse the pages. Yes, Chinese characters are nicely displayed.
4. Conclusion
I learnt a lot from this project. I learnt how the DNS works and how to configure it. I got deeper understanding of the httpd client/server model. I knew the configuration of httpd. I also got a view of how DNS works for httpd, and how to construct a virtual web server using DNS.
I also clarified that it’s X Display server, instead of X application, to be responsible for handling the screen display such as language encoded character. In this way, sharing of many resources (such as font library) among X applications is possible.
During the project development, I read the TCP/IP Network Administration, an excellent book leading me to configure the named. I also read the Virtual Web Sever HOWTO and some online sites on virtual web server. I benefited a lot from discussion with friends, consulting with some experts in our department. Thus I can say I learnt how to develop a project making use of all kinds of media.