Web Server @ Home is where this series commenced. This is follow up to that discussion. Please read it if you want to know motivation behind this discussion.
Apache2 is the one of the best Web Server out there. And it is free too!! According to Apache Official Site (http://www.apache.org),
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
Apache has been the most popular web server on the Internet since April 1996. The November 2005 Netcraft Web Server Survey found that more than 70% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined.
The Apache HTTP Server is a project of the Apache Software Foundation.
Followings are detailed information on how to install Apache2 over cygwin/Windows XP.
Please note that do not install Apache using cygwin setup, because we want to build Apache for Windows Native Machine because of performance reasons. Assumed is that all the steps for cygwin installations are followed as outlined in Web Server @ Home – Installing cygwin.
Apache2 Installation on cygwin/Windows XP
- Install cygwin as outlined in Web Server @ Home – Installing cygwin.
- Download Apache Source Code. Please do not download from official Apache, instead use cgywin setup program to download. Patch is required to build Apache2 on cygwin and that is available via cygwin setup program. For this
- Open cygwin setup.. This is setup.exe which was downloaded first before even cygwain was installed
- Go through all the step till you reach package selection window. Click on view button until your see full or click on web catagory.
- Select Apache 2. Unselect binary and select Source option.
- Downloaded Apache 2 Source is unpacked into /usr/src directory. Please verify all the packages (as outlined before) are installed including patch & libtools1.5.
- Go to /usr/src directory. Execute 'cd /usr/src' for this (You probably know it because only UNIX/Linux freaks are going to do work with cygwin 🙂
- Apply patch by running following command
run apache.xxx.sh prep
- apache.xxx.sh provides many options but please do not be tempted and do as exactly told.
- cd httpd-xxxx directory and run following configuration script
configure –enable-so –enable-rule=CYGWIN_WINSOCK –enable-rule=SHARED_CORE –enable-module=all –enable-mods-shared=most
- Above configuration scripts configures to generate shared loadable modules and uses Native Windows Socket for Apache Specific System Calls. Because of Shared Modules Option, Apache server will use only required amount of memory (Significant, considering if few modules are used and Apache spawns multiple processes) but performance hit will be of 5% & initial load time will be little higher.
- Native Windows Socket use improves performance by 30%. Big huh!! That's why we wanted to build it by ourselves.
make; make install
- Files will be installed in /usr/local/apache2, See if all directories & modules are properly installed including lib etc. Look for httpd.exe, apachectl, aspx in /usr/local/apache2/bin
- Check for httpd.conf file in /usr/local/apache2/conf
- See if all files in bin directories are executables and have appropriate permissions, if not, change mode using chmod
- Go to /usr/local/apache2/conf directory & create a directory called conf.d if it doesn't exists.
- Edit conf file for user name and password
- Remove any unnecessary module from httpd.conf (Look for AddModules and comment out not required ones)
- Go to /usr/local/apache2/bin, edit apachectl and replace httpd2 with httpd
- Run following command and look for basic errors. Correct if you can otherwise you can ask me.
- If everything is okay, run "apachectl -k start", it will start Apache server. Look for host information/IP information which is printed by this command.
"apachectl -k start",
- Open a browser, type in IP address (host name) of your machine, it should be working now.
Apache installation is finished..