For the Home Technology Enthusaist

Setting up Apache Web Server on Windows PC

 
     
 
lefttop
 

 

Setting up Apache Web Server on a Windows PC

A great deal of information on Apache can be obtained from various websites starting with the official Apache website.  The purpose of this technical paper is to focus on specifics that are important to installing and operating an Apache based Web Server on Windows XP and Windows Home Server. Importantly, these specifics have been determined by way of actual implementation and are not commonly found in other literature. The version of Apache used in this implementation was 2.0.63.

 

This technical paper is intended to be supplementary to all that is available at the official Apache website and elsewhere, with the main purpose of sharing specific details pertaining to implementation of Apache HTTP server on a Windows-based PC - a 'gap filler' if you will. Newbies are encouraged to browse the  official Apache website, specifically the 'HTTP Server' and documentation associated with it prior to implementation.

 

Two very valuable books on Apache are:

  1. "Apache Server for Windows" - Little Black Book from Coriolis Technology Press; Authors: Greg Holden with Matthew Keller; ISBN 1-57610-391-9
  2. "Apache Server Unleashed" from SAMS Publishing; ISBN 0-672-31808-3

It would be very useful for the user to read through these books and to have these books around during the installation and setup of Apache. This technical paper by itself should enable the installation and operation. However, given the myriad of Windows  environments out there, some tweaking to the setup details described herein may be necessary.  

 

For the purpose of this technical paper, a Web Server is defined as a combination of computer hardware and software that supports the main protocols of interaction with the user's web browser (e.g., Internet Explorer) or other client applications (e.g., FTP client).

 

Note that Apache is only a piece of the puzzle of a Web server, albeit an important piece. Apache is only an HTTP server and in being that, is capable of communicating with only those clients that support the HTTP protocol (e.g, Internet Explorer). Apache cannot communicate for example with an email client or a FTP client. A HTTP server like Apache will suffice for a lot of the common usage needs of a home web server. Other aspects of a web server such as FTP, email, DNS, etc. have to be addressed separately. This paper includes information on a complementary FTP server, which together with Apache will enable the user to have a basic Web Server on his/her Windows machine.

 

The setup described herein has adequate security for its target application, which is home use. It is not meant to handle a large e-commerce website. Nor does it enable one to become a full service ISP. It should enable one to have a personal/family website using the simple resources of a home computing environment, without having to fork up a monthly fee to an ISP or be limited by the amount of disk space that ISPs typically provide (e.g, 1GB). 1GB may seem large but once you start storing high quality photos and small video clips on a website, it will be consumed in no time. The setup described herein could also be very helpful to anyone trying to start a sole proprietor business that would need to minimize startup-marketing costs. The web after all is one of the most effective tools available to get your message to a wide audience across the globe.

 

Describing the setup for a Windows XP environment may seem dated since most machines available today in the market are pre-loaded with Windows Vistaor Windows 7. A few good reasons for selecting Windows XP:

  1. Apache does not yet claim verified operational compatibility with Windows Vista.

  2. Upgrade to Windows Vista has had mixed experiences, Windows 7 is brand new, and there are plenty of Windows XP machines out there fulfilling users' current needs just fine

  3. Setting up a Web Server could be a good re-use of Windows XP machines even after more powerful Vista and 7 machines replace them! 

While the operating system (XP) is at the core of this implementation, much of the paper discusses Web Server specific issues and not issues pertaining to the operating system environment. The concepts and procedures described are valid for the most part irrespective of the operating system.

 

A quick overview of the steps involved in establishing a Web Server on a Windows XP PC is given below. It is highly recommended that this paper be read through in its entirety prior to implementation.

 

  1. To have an effective web server at home, you must have a broadband, always-on Internet connection. 
  2. Choose a reasonably powerful hardware platform. A Pentium 1.6GHz processor with 512MB RAM and 160GB hard disk should do for starters. More powerful hardware is needed only if you expect enormous traffic on your website and/or you plan to webhost a large number of users. For networking purposes, a 10/100BT interface is required and therefore install a 10/100BT Network Interface Card (NIC) in the platform.
  3. Format the hard disk and install Windows XP ('clean' install). Ensure that all networking support components (including TCP/IP) are installed. By default, Windows should enable networking support upon detecting the 10/100BT interface.
  4. Ensure that the PC is talking to the Internet - through your DSL connection.
  5. Download the Windows binary of Apache from here on this website. 'Windows binary' means that the Apache HTTP server application software is compiled already to run on Windows XP. All you have to do after downloading the file is to double-click it to install. Alternatively, you can download the same file (or if you prefer, a later version) from the official Apache website (look for Apache under HTTP Server - and be sure to download the Windows binary MSI installer package, NOT the source code package.
  6. Install Apache by double-clicking on the downloaded MSI Installer package file. It is strongly recommended that you accept all default values during the installation process, and follow all instructions carefully. A successful installation is verified by typing http://localhost in the browser on your machine. A message announcing successful installation will appear.

With the successful installation of Apache, the HTTP server part of your Web Server is taken care of. 

 

An essential complementary application is a FTP server that will enable the transfer of files into and out of your web server. HTTP can by itself support such transfers. However, your Web Server becomes more vulnerable to security breaches as a result. It is therefore recommended to use a separate FTP server and to not enable file transfer features of HTTP.

 

A number of FTP server packages are available in the market. A good package is BulletProof FTP (BPFTP), available from www.bpftp.com. Installation of BPFTP is akin to any Windows program.

 

With HTTP and FTP taken care of, a basic Web Server is ready for operation on your Windows PC. But before it can begin to function effectively as a website, some additional steps need to be taken. They are:

  1. Registering your domain name with any of the registrars in the market (e.g., www.domaindirect.com). Domain name registration through a registrar typically involves a fee and depending on the product chosen, registration has to be renewed periodically (e.g., annual, 2 years, 5 years, etc.).

  2. Associating your domain name with the IP address of your web server.

If all is well, you will have then established your own home-run website on the Internet, for the whole wide world to access!

 

A word on forward slash (/), back slash (\) and double-quotes (") - one of the 'quirks' of the documentation on Apache is that given Apache's historical tie up with Unix and Linux, a vast majority of documentation uses the Unix/Linux language. Example, system root directory is denoted by / and all directory path names use forward slash (/) in the character string. For Windows users, this could create a lot of confusion.

 

Following are some tips for Windows users in this regard:

  1. Replace all references to forward slash (/) with back slash (\) except where explicitly forbidden.

  2. Assume system root directory to mean C:\

  3. Use double-quotes (") when using directory names that have spaces in the names (example: a Windows directory by name C:\Program Files should be placed within double-quotes as "C:\Program Files"). This is very important. Else, Apache will misinterpret, ignore or throw up error messages.

Technical Background:

While the reader is assumed to be familiar with the basic principles of the Internet and with many of the technical terms used therein, a brief background is included as a reference point for this paper.

 

Few will venture into defining and describing the operations of the Internet in a precise manner. For, it is a network system that has evolved from its humble beginnings in the 1960s to a colossal and heterogeneous network of complex hardware and software systems today.  There are numerous aspects of its operation and each aspect can by itself be the basis of a book and in some cases even of several books.

 

The aspect of particular significance to this paper is the process of connecting a user to a website within the Internet. This is because of the IP address and Port forwarding issues that affect the operation of a home-based Web Server especially in an environment using ISP provided routers. The connection process within the Internet can be best understood by taking a closer look at how another familiar (and equally complicated) network operates in this regard - the telephone network.

 

In the telephone network, each telephone connection (essentially a user premises and therefore implicitly a user name) is assigned a unique telephone number. The network has a huge database of these telephone numbers and their associated telephone connections. There is also another published database, which is essentially a listing of telephone numbers and the associated user names. This database is the Directory. When a user wishes to call someone, the user looks up his or her name in this Directory and dials the number that is associated with that name. A few short moments later, the connection is made and the conversation begins. This call connection or call routing process within the telephone network relies on one fundamental underlying characteristic and that is the fixed relationship between a telephone number and the physical connection. This fixed relationship enables the network to route a given call correctly with a simple lookup of its internal database and associating the called number with the corresponding physical connection.

 

The Internet works in much the same way but with some important differences. Each connection on the Internet - termed a site or website - is assigned a unique IP address just as each telephone connection is assigned a unique telephone number. Similar to the telephone network Directory, the Internet maintains a database of websites and associated IP addresses. And just as the telephone network routes a given call using the one-to-one relationship between the telephone number and the physical connection, the Internet routes a call using the one-to-one relationship between the IP address and the website.

 

Text Box: It is to be noted that any computer that connects to the Internet – even if only briefly through a dial-up, becomes a site or website for that duration. 

IP stands for Internet Protocol, and plays an extremely important role in making connections and transporting data across the Internet.

The term call in Internet refers to the connection that is made between the user's computer and the website's web server.  For instance, when a user types www.apache.org in his/her browser, we can say that the user is effectively calling the website referred to by the name www.apache.org. The Internet successfully connects that user to www.apache.org, since it knows the IP address of www.apache.org from its database, and therefore can route the call correctly. This IP address-based connection is the underlying mechanism for all Internet connections.

The Directory listing that the Internet maintains, together with related functions and services are collectively known as Domain Name Service and a system that hosts this service is referred to as a Domain Name Server (DNS). DNS is the backbone of the connection process within the Internet. Without DNS, we would have no choice but to remember the IP addresses of each and every site or website we wish to access.

 

Figure 1 below illustrates the connection principles of the Telephone and Internet networks.

 

Figure 1: Telephone Network and Internet  - a comparison

 

An important difference to be noted between the Telephone and Internet is as follows. In the telephone network, the association is between the telephone number and the actual physical connection (often called a 'Line'). This means, all telephones connected to that physical connection would end up being identified by the same telephone number. The exception to this is the digital telephony network called ISDN. A discussion of that topic is beyond the scope of this paper. Also, a greater percentage of the global telephone network is still non-ISDN.

 

In the Internet on the other hand, the association is between the IP address and the computer connected to that connection. Hence if there are a number of computers connected to one physical connection, each computer is associated with a unique IP address. So a given physical connection may have more than one IP address assigned to it and access to any of those IP addresses will be routed over the same physical connection.

 

This difference although important, is not material to the topic of discussion in this paper.

 

The Dynamic IP issue

In the telephone network, the relationship between a telephone number and a physical connection is fixed and stays the same unless the service is cancelled or changed. In the Internet however, the relationship between an IP address and a website is not always fixed. Two mechanisms are prevalent - one involving fixed relationship between a given website and its assigned IP address (called static IP) and the other involving changing relationship between a given website and its assigned IP address (called dynamic IP).

 

The need for dynamic IP address stems primarily from the need to efficiently distribute the limited number of IP addresses currently available. Even though this number is huge - several million, it is still not enough to support the connection of each and every computer user in the world that wishes to join the Internet.

 

Significance of Dynamic IP

The significance of dynamic IP in the context of this paper stems from the fact that most it not all DSL connections implement the dynamic IP addressing scheme. Even though many a DSL connection is termed 'Always ON', the fact is that the IP address that is assigned to that connection is not static and is subject to change without any notification.

Given that the underlying mechanism for establishing connection between a user's computer and a website is based on knowing the IP address of the website, the dynamic IP address nature of DSL connections poses a problem to the Internet to locate you home-based server.

 

The solution to this problem is the Dynamic DNS service (DDNS). A function of DDNS is to update the Internet's DNS database periodically with any change in IP addresses of websites. This ensures routing of calls even when a website's IP address changes. It is to be noted that there is an interval of time between the change of an IP address and the update of the DNS database when a given website maybe inaccessible.  But for this 'small' problem, using DDNS solves the issue faced with dynamic IP addresses. There are a number of DDNS service providers in the market. One such provider is No-IP (www.no-ip.com). No-IP provides a Windows client software running on your PC that works in tandem with their DNS server to keep current at all times, the association between your dynamic IP address and your domain name. And by assigning their DNS server for your domain name, the required association between your domain name and IP address is established at all times. No-IP's client software called DUC (Dynamic Update Client) is available for registered users of No-IP on their website.

 

If you have static IP with your Internet connection - such as with many Cablemodem connections, then the DDNS issue is moot.

 

Significance of Domain Forwarding

For your home-based Web Server to be accessible from the Internet, the Internet needs to associate your domain name (e.g., www.yourdomain.com) with your Web Server's IP address so that proper call routing can take place. This association is established by forwarding your registered domain name to your DDNS domain name. As an example, if your registered domain name is www.yourdomain.com and the DDNS domain name that you have registered with No-IP is yourname.no-ip.org, then www.yourdomain.com needs to be forwarded to yourname.no-ip.org. And since your DDNS knows the IP address of your Web Server through DUC, all calls made on the Internet to www.yourdomain.com will now be routed correctly to your Web Server.

 

Significance of Port numbers

We have so far discussed the significance of IP address and how the Internet uses IP address to establish connection between two computers on the network. While this is an essential step to providing services, it is by itself not sufficient.

 

A Web Server has many services that it offers - browsing of web pages stored in it (via HTTP protocol), transferring files stored in it (via FTP protocol), to name two. How does the Web Server tell apart requests routed to it, since all of the requests will have the same IP address? Enter Port numbers. As part of the protocol that computers on the Internet use, a Port number is appended to the IP address in the request packet, to distinguish the various service requests that are made. Port numbers range from a value of 0 to a value of 65,536. Certain Port numbers are 'reserved' and used as default values. For example, if no Port number is explicitly appended in a request for HTTP service, Port number 80 is assumed. Likewise Port number 21 is assumed for FTP requests.

 

Notwithstanding the reserved Port numbers, a HTTP server (such as Apache) running on a given Web Server can be configured to serve on a different Port number e.g., 9876. Similarly an FTP server can be configured to serve on Port number 3456. On a home-based Web Server, it is to your advantage to change the Port number of Apache and BPFTP away from the default values of 80 and 21 respectively. This will avoid any potential conflict with your ISPs HTTP and FTP servers.

 

Using a Router

A small investment that would be a big pay-off in a home environment is a hardware router. Router is a device that - as its name implies - simply routes IP packets, based on the packet's IP address and Port number.

 

If your current network setup does not have a router, it is highly recommended to procure and install one. Use of a router alleviates numerous issues when it comes to managing and maintaining a home network. While software firewalls and routers running on a PC are aplenty, they add a few layers of otherwise avoidable difficulties in diagnosing and fixing network problems. The plunging router prices make the case for a separate hardware router that much stronger. Besides, with the increasing adoption and ease of use of wireless home networking, a hardware router supports more flexibility in network configuration, operational reliability and expandability.

 

Most home-use routers serve also as a firewall between your home network and the Internet, thereby preventing hackers and other malicious users from gaining illegitimate access to your Web Server, PCs and other devices attached to the network. Firewalls are a double-edged sword. While they help prevent illegitimate/unauthorized access, they can also come in the way of legitimate access to your Web Server. Firewall function can be and are implemented in a number of ways. Most home-use routers implement it by a simple filtering process involving IP address, Port numbers and Protocols (HTTP, FTP, etc.). By default, most firewalls will prevent any request from the outside from going through to your home network. This will therefore include even legitimate HTTP or FTP requests to your web server. Therefore, it is imperative that the firewall be selectively 'opened up'. The selective opening up of the firewall is called Port-forwarding in the router/firewall language. It is critical that the firewall Port-forwarding configuration match the configuration of your HTTP and FTP servers. The implementation example given later in this paper illustrates this issue more clearly.

 

Content Creation

Having setup the Web Server, the next step is to create content that will be 'served'. This can be from very simple HTML pages of information to a complex set of pages involving Flash, XML and other advanced Web technologies.

 

There are a variety of tools available - including Freeware - for developing Web content. A Google search will give you the choice you need. A good home-user tool is FrontPage from Microsoft. Some Web Hosting service providers (such as GoDaddy) offer tools also.

 

Organizing your Website

If during installation all default values are accepted, Apache expects all content that it serves to be in its root htdocs directory (Path: C:\Program Files\Apache Group\Apache\htdocs).

A good way to organize your website would be as follows:

 

  1. Create a subdirectory for each of the domains under root htdocs. The resulting path names would be - a) C:\Program Files\Apache Group\Apache\htdocs\yourdomain; b) C:\Program Files\Apache Group\Apache\htdocs\timbuktu; and c) C:\Program Files\Apache Group\Apache\htdocs\charity

These are the home directories where you would store the respective home pages (index.htm or index.html file) and all associated web files. The respective index.htm or index.html file is what Apache would serve first upon any request for www.yourdomain.com, www.timbuktu.org and www.charity.org.

  1. Now, create a further subdirectory under each of those home directories for each of the subdomains. The resulting path names would be - a) C:\Program Files\Apache Group\Apache\htdocs\yourdomain\private; b) C:\Program Files\Apache Group\Apache\htdocs\yourdomain\public; c) C:\Program Files\Apache Group\Apache\htdocs\Timbuktu\visitor; and d) C:\Program Files\Apache Group\Apache\htdocs\charity\favorite.

These are the home directories for each of the subdomains where you would store their home pages and all associated web files. The respective index.htm or index.html file is what Apache would serve first upon any requests for private.yourdomain.com, public.yourdomain.com visitor.timbuktu.org and favorite.charity.org.

While there is no rigid set of rules to organizing websites, it is helpful to organize them in a manner that is supportive of their maintenance such as regular backups, updates, implementing protected access, etc.

 

Tips and Notes for Customizing and Enhancing Apache

The following material is based on the experience of porting of Apache v 2.0.63 on a Windows XP SP2 and Windows Home Server platforms. The setup has been tested to work reliably for continuous operation without any human intervention. A caveat: the traffic on the site has been light (< 100 hits per day).

 

It is recommended that the target Windows XP machine be dedicated as a Web Server and not be crowded with other applications such as games, video editing software, etc. Since Apache is only a HTTP server, additional web service related packages such as BPFTP may be installed on the same machine.

 

Customizing Apache

Apache v 2.0.63 has a single configuration file named httpd.conf that controls its operation. This file is located in C:\Program Files\Apache Group\Apache2\conf. This file is an important file and it is highly recommended that the file be backed up prior to making any changes. It is an ASCII file and must be edited using a text editor (as opposed to a word processor). If you must use a word processor, be sure to save the file back as a text only file. The default version of httpd.conf that comes with Apache is structured and commented sufficiently to be user-friendly. It is recommended that you maintain the structure and add comments as changes are made.

 

Control of Apache is achieved by including Directives and their associated Arguments/Parameters  in the httpd.conf file. A list of these directives can be found in the reference books cited at the beginning of this paper. A detailed description and explanation of the directives is beyond the scope of this paper. The following sections mention those that are relevant to the topic of discussion.

 

First things first - change the Port number from the default of 80 to something else e.g., 8180 or something. This will enhance security and will also help in differentiating your server from the standard 80 that many Internet sites use. Some ISPs block port 80 and may prevent your server from being accessible. Changing Port number is achieved using the Port directive in httpd.conf file.

 

Changing the port number has an important side effect. Recall the domain forwarding issue discussed earlier in the paper. Be sure that the domain forwarding now specifies your new port number. Example - http://www.yourdomain.com should now be forwarded to http://yourddns.domainname:8180. The good news is that the user accessing yourdomain.com will not have to worry about specifying port numbers - he/she simply types http://www.yourdomain.com and the forwarding takes care of the port number issue.

 

Virtual Hosting

Virtual hosting is one of the most powerful and desirable features for a home user interested in hosting more than one domain on his/her PC. Apache supports many ways of implementing this feature. For most home users,  the single-instance-single-machine (SISM) method may be most suitable since it requires the least amount of resources (memory, disk space, hardware components). The SISM method requires only one NIC card and one IP address to be assigned to that machine.

 

An assumption being made in the following discussion and description is that the PC on which you are planning to host domains has a local static IP address.

 

Through trial and error found the following Virtual Host settings to work reliably in the dynamic IP environment. There is a section in httpd.conf relating to Virtual Hosting which is where related parameters are set.

 

The NameVirtualHost directive and its parameter is again because of the name-based virtual hosting that was selected as opposed to an IP-address based virtual hosting. This setting is a global in scope and is not required for each domain.

NameVirtualHost YourPCsLocalIPaddress

 

The settings shown below this paragraph are 'core' to virtual hosting and there must be one for each of the domains being hosted. Additional settings are required to enhance and customize Apache in the way it serves each domain.

<VirtualHost YourPCsLocalIPaddress>

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/SubDirName"

ServerName YourDDNSdomainName

</VirtualHost>

 

Please note the YourPCsLocalIPaddress specified above. This is the address of your PC on the home network side. Even though DHCP is very useful and you may choose to use that as the mechanism for assigning IP addresses in your home network, use of a static IP address for the PC running Apache is necessary for the settings shown in this section to work.

 

For the three example domains mentioned earlier, the core settings would be as follows:

<VirtualHost YourPCsLocalIPaddress>

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/yourdomain"

ServerName YourDDNSdomainName

</VirtualHost>

<VirtualHost YourPCsLocalIPaddress>

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/timbuktu"

ServerName YourDDNSdomainName

</VirtualHost>

<VirtualHost YourPCsLocalIPaddress>

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/charity"

ServerName YourDDNSdomainName

</VirtualHost>

 

Here is how the pieces of the puzzle fit together:

  • Domain Forwarding has been set as follows:

    • http://www.yourdomain.com to http://YourDDNSdomainName:Port Number/yourdomain. Therefore any request coming to www.yourdomain.com will be routed to your DDNS first which in turn will route it to your machine.

  • Apache gets the request as http://YourDDNSdomainName:Port Number/yourdomain. The name-based virtual hosting parameters set in the config file directs apache to serve contents stored in the C:\….\htdocs\yourdomain directory - and importantly from that directory and its subdirectories only.

 

Important security issues to be considered:

When hosting multiple domains, it is extremely important that requests are never served out of the wrong directory. Clearly, the first line of defense is Apache's built-in security. While this is reliable, it is important that you configure Apache to handle exceptions properly.

 

For example, by default, Apache expects a file named index.html to be present in the directory it is serving a request from. If it does not find that file, then again by default, it shows that directory as a directory listing in the user's browser window. Using this entry point, and with no further restriction configured, the user can pretty much navigate through other directories. It is therefore important to change such default settings in order to avoid 'trespassing'. This is perhaps one of the first things you want to do before activating virtually hosted domains. Apache applies any and all directives under the each Virtual Host section only to that domain. So by appropriately including restrictions, you can tailor the security for each domain being hosted.

 

Protecting Access to Content

Apache provides for protecting either part or all of the content of a given website. In this context, website refers to the set of files and directories associated with a given domain name. And 'protection' means access is allowed only after authentication - a process which prompts the user for an ID and a password and unless they are validated, access is denied.

 

Apache supports a few authentication mechanisms - from a simple one to an encrypted one that follows industry standards. For home-use applications, a simple one may be adequate.

 

A simple authentication mechanism is implemented as follows:

  1.  Create a text file that has pairs of user IDs and corresponding passwords.

  2. In Apache's configuration file (httpd.conf), add the following directives for the directory/(ies) you want protected

Directory "C:/Program Files/Apache Group/Apache2/htdocs/directoryname"

Options    Indexes

AllowOverride    none

Order    allow, deny

AuthType    basic

AuthName    "Protected Space"

AuthUserFile    "C:/Program Files/Apache Group/Apache2/Access/apachepwd.txt"

Require    valid-user

</Directory>

 

The directives in the above relating to authentication are AuthType, AuthUserFile and Require. AuthType specifies the type of authentication, which in the above example is set to basic. The AuthUserFile points to the text file containing User IDs and Passwords. Be sure to include the entire path name. In the above example, the filename is apachepwd.txt and is located in a directory called Access under Apache. Be sure also that the directory containing this file is not accessible to anyone from the outside. The Require directive completes the stipulation for authentication. All these directives are for the directory specified in the Directory directive.

 

Going back to the example domains we have used, in order to protect access to private.yourdomain.com, the following has to be included in the httd.conf file:

<Directory "C:/Program Files/Apache Group/Apache2/yourdomain/private"

Options    Indexes

AllowOverride    none

Order    allow, deny

AuthType    basic

AuthName    "Protected Space"

AuthUserFile    "C:/Program Files/Apache Group/Apache2/Access/apachepwd.txt"

Require    valid-user

</Directory>

CGI Support

There is no native support for CGI in Apache. In order to be able to support CGI on your Apache website (e.g., Perl scripting), you have to download the appropriate module and establish an association between the CGI type and the corresponding module.

 

Significance of CGI Support

If you desire for your website to be more than just a passive information source and allow for user input and interaction using things such as forms, then CGI support is a must. Why Perl? Simply because, it is one of the more capable and easy-to-use CGI languages out there and hence a popular one. A useful place to start if you are new to Perl is www.perl.com.

 

A variety of Perl modules are available in the market. The package installed on this web server was ActivePerl 5.6.  It can be downloaded from www.activestate.com. When you first visit www.activestate.com, it may appear that you have to pay to download and use this module. But you don't have to - at least as of Dec 2002. The package you want to download is the MSI Installer package (filename: ActivePerl-5.6.1.633-MSWin32-x86.msi). The process of downloading and installing is quite self-explanatory. It is recommended that the user accept all default values during the installation process. If accepted, Perl will be installed in C:\Perl directory. For Perl support to be activated, the only thing necessary at this point is for the first line of all Perl script files to have the entry #!C:\perl\bin\perl.exe.

 

The httpd.conf file has to be configured to recognize the directory in which Perl script files are stored. The name of the directory is not restrictive although it is recommended that the user follow the industry practice of using cgi-bin or cgi as the name. Please note that a CGI directory must be created for each domain and is best placed under the root directory of that domain. Specification of the cgi directory names in the httpd.conf file involves the use of ScriptAlias directive. This is best done under each virtual host section as shown below in the example.

<VirtualHost YourPCsLocalIPaddress>

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/timbuktu"

ServerName YourDDNSdomainName

ServerAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/htdocs/timbuktu/cgi-bin/"

</VirtualHost>

 

<VirtualHost YourPCsLocalIPaddress>

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/charity"

ServerName YourDDNSdomainName

ServerAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/htdocs/charity/cgi-bin/"

</VirtualHost>

 

Configuring BPFTP

Recall that each domain name (essentially, the domain owner) has a subdirectory under the root htdocs directory of Apache. When setting up user accounts in BPFTP, be sure to set the correct upload default directory for each user (the domain owner) and also be sure to set restrictions for that user so that unintentional or intentional trespassing can be avoided. Other than this important security issue, nothing unique or 'tricky' is required of BPFTP.

 

Implementation Example

The following is an actual implementation of Apache with Perl support and BPFTP server on a Windows 98 SE machine in a home network environment. The same setup has been tested successfully on Windows XP, and Windows Home Server machines also. Figure 2 shows the overall network setup along with key setup parameters. For confidentiality purposes, the actual domain names or parts thereof have been replaced with fictional ones.

 

Apache on Windows Home Server - a special note

Windows Home Server (WHS) has a built-in HTTP server - Microsoft's IIS - that runs by default. WHS is essentially Windows Server 2003, 'dumbed down' to suit home use. When you install Apache on WHS, you will likely get an error message at the tail end of the process essentially saying installation was not successful. DO NOT PANIC. Ignore this error message, and complete the installation process. Go into Apache/Conf directory, and change the Port number to something other than 80 in the httpd.conf file (e.g., to 8080). The error message is caused because of Port 80 conflict between the IIS server and Apache server i.e., both are attempting to use the same port for service.

 

www.no-ip.com is the DDNS service provider. www.domaindirect.com is the domain name registrar.

 

 

Figure 2: Web Server setup

 

Handling Subdomains:

If you desire to use subdomains under your main domain name, then the above setup has to be enhanced as follows:

 

Recall that each subdomain has its own directory structure under htdocs. In domaindirect.com, set the HTTP forwarding for each subdomain to me.no-ip.org:8880/subdomainDirectoryName. For example, if in the above setup, we  desire to have private.mydomain.com, then domaindirect.com's HTTP forwarding should be set as private.mydomain.com --> me.no-ip.org:8880/private where private is a subdirectory under htdocs/mydomain. Remember to include the port number as part of the forwarding address. This concept can be extended to host multiple users under your domain.

 

In the example above, you may notice the use of Alias to handle non-HTTP requests. This is because Domain Forwarding applies only to HTTP, at least in the services offered by www.domaindirect.com.

 

 

 

 

 
righttop