Beginners Guide: Install Apache 2 Web Server on Windows (Local Installation)

September 2, 2007 – 11:12 pm

For beginners out there, here is a simple guide for you to run Apache 2 web server locally on your Windows machine. Running a web server locally means that you will give your machine a local, imaginary domain name such as www.yourmachine.com or www.ihavemyownwebserver.com.

 

apache-logo

A local web server can serve web pages as a live web server, but it is restricted to machines from your local area network. A local web server can’t server web pages to users on the Internet - you need to buy a proper domain name and a live web hosting service for that to work.

 

Advantages of a Local Web Server

  • It is free to use - you don’t have to buy anything to have a local web server. You don’t need to have a live Internet connection to run it too!
  • Great for testing out products - you can test many web applications with a local web server. You can run Wordpress, ActiveCollab and more!
  • Enjoy the same web server experience - running a local web server does not differ much from running a live one. The only difference is that your web server will only be available on your LAN.

 

 

Step by Step Installation of Apache 2 Web Server on Windows

I tested this on my machine that runs Microsoft Windows 2000 Professional. Windows XP users should have no problem using this guide.

 

Network Setup

1- Open up your “hosts” file with a Notepad. On Win2K, it is located at C:\WINNT\System32\drivers\etc. On WinXP it is located at C:\Windows\System32\drivers\etc.

 

2- Check out the line that starts with 127.0.0.1. Add your imaginary web server name at the end of the line. Put something like www.syahid.com or www.mywebserver.com. Save your “hosts” file.

A “hosts” file is used to map your IP address to a server name. In this case, 127.0.0.1 equals the web server name of your choice.

Example hosts file line: 127.0.0.1 localhost syahid www.syahid.com

 

3- Click your Windows Start button. Click on “Run“. Type “cmd” and click Enter. A DOS command prompt will appear.

 

4- Type “ping www.syahid.com” or whatever name you give your web server before. Your machine should give a reply as shown in the picture below.

ping-your-own-web-server

 

Download and Install Apache Web Server

5- Go to Apache 2 download page. Always download the latest stable version. During the time of this installation, the recent stable version of Apache 2 for Windows installer (.msi file) is 2.2.4. Download this file to your Desktop.

 

6- Right click on the the installer file, select “Install“. Accept the agreement and click Next. Click Next once more.

 

7- Fill in your web server information details as shown in the screenshot below.

apache-server-information

For example, if your server name is www.syahid.com, here is what you fill in in the fields:

  • Network name : syahid.com
  • Server name : www.syahid.com
  • Administrator’s name: <leave this as default>

Click Next again.

 

8- Select “Typical Install“. Click Next.

 

9- Accept the default installation path - C:\Program Files\Apache Software Foundation\Apache2.2\ , or change it according to your preferences. Click Next to proceed.

 

10- Wait until the installation is over, then click Next once more and click Finish to wrap up the installation process. Apache will starts automatically and you can see a “green Apache icon” on your taskbar.

apache-server-started-icon-on-taskbar

 

Test Apache Web Server Installation

11- Click on the icon as shown above, click “Open Apache Monitor“. Try to Stop, Start and Restart the web server service from the Apache Monitor console. Make sure every step is successful.

test-apache-start-shutdown-restart-apache

 

12- Open up your browser. Type in your web server address, e.g http://www.syahid.com . If there is no problem with your installation, you shall get the “It works!” page.

apache-installed-and-working-it-works-screen

 

Your Apache 2 web server installation is a success! Congratulations! Now you can fill in your web server directory with all your HTML files. Your default web directory page will be C:\Program Files\Apache Software Foundation\Apache2.2\htdocs .

 

That was easy! Maybe next time I will show you on how to integrate support for PHP and MySQL into this installation. So don’t forget to check out this site soon!

 

Tags: , ,

Love this post? You may want to subscribe to my RSS feed. Thanks for visiting!

Related Posts:


  1. 29 Responses to “Beginners Guide: Install Apache 2 Web Server on Windows (Local Installation)”

  2. one Apache package that I have used for some time is Apache2 Triad, a WAMP distribution. this has a full install of Apache,PHP,Perl,Mysql,SlimFTP and more. Which makes testing database driven apps,and php apps and more very simple with a one click install

    By CrossFire on Sep 4, 2007

  3. yes this is also possible. you can even use an application called xampp. but if you want to learn a little bit extra, manual installation is the best!

    By syahid on Sep 4, 2007

  4. sy dah berjaye install but then i cant run the apache weh server…y is that?..thanks

    By najlaa on Sep 17, 2007

  5. can you please check C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.logs. And what do you mean that you can’t run apache server?

    By admin on Sep 17, 2007

  6. thank you!

    By aserty on Oct 23, 2007

  7. you are welcome!

    By TechMalaya on Oct 23, 2007

  8. Hi, thanks a lot!

    By Aki on Nov 2, 2007

  9. you are welcome. do share this among your friends for mutual benefit. :D

    By TechMalaya on Nov 2, 2007

  10. Tak perlu susah-susah. Muat turun saja dan pasang Apache2Triad. Semuanya akan ditetapkan oleh perisian berkenaan dengan sendiri. Saya telah lama melaksanakannya.

    By dr izdor on Dec 8, 2007

  11. @ dr izdor: Betul. Tapi kalau inginkan lebih fleksibiliti, menambah kemahiran diri. Setup sendiri adalah cara terbaik. Dan saya pasti Apache2Triad tak sesuai untuk production web server.

    By Syahid Ali on Dec 8, 2007

  12. when installing apache 2.2 on winxp get a error message cannot open device or specific folder

    By kevin on Mar 12, 2008

  13. posted message sorted error it was due to the file being encrypted - thanks for your site

    By kevin on Mar 12, 2008

  14. Hi Syahid,

    Thanks for your instructions, I successfully installed Apache, but got the following errors. Please help!

    1. What is “The operation has failed?” after I clicked Start from Apache Service Monitor?

    2. What does this mean on Error Log?
    [Fri Apr 11 20:40:59 2008] [crit] (OS 10022)An invalid argument was supplied. : Child 2344: setup_inherited_listeners(), WSASocket failed to open the inherited socket.
    [Fri Apr 11 20:40:59 2008] [crit] Parent: child process exited with status 3 — Aborting.

    Thanks - Jon

    By Jon on Apr 12, 2008

  15. @Jon: I recommend that you uninstall, delete the Apache folder, and reinstall Apache again. That looked serious! If it happened again, go to Apache Forum for expert tips.

    By Syahid A. on Apr 12, 2008

  16. Everything went perfectly for Apache 2.2.8 install onto my Tablet Laptop running XP Pro. Thanks for the help/screenshots. Now I plan to install MySQL 5.0.51a & PHP 5.2.5

    All so I can learn and help with the growth and development of an older website

    Thanks again and if you know of any great tutorials…

    By Joe on Apr 24, 2008

  17. @Joe: Good luck Joe! I hope you can continue all the planned work with success.

    By Syahid A. on Apr 24, 2008

  18. Superb! Thanks a ton.

    By Rajesh Panchal on May 14, 2008

  19. I have followed the instructions above, and installed apache2.2.6 on D:\Apache2.2. My httpd config:
    ServerName testing.co.nz:8080
    Listen 8080

    The server is running and stopping fine, except when i typed http://www.testing.co.nz in the firefox browswer i was propmted for the username and password.

    How ever if typed http://www.testing.com:8080 i get “It works” page.

    where do i go wrong please help me…..can someone explain to me. thanks.

    By 11Tigers on May 29, 2008

  20. @11Tigers: I don’t know what went wrong. Looks like a broken .htaccess file / misconfiguration. Try Listen 80, and ServerName www.testing.co.nz first before changing it to 8080. Make sure that you are not running any other service with port 80 or 8080. And one more, make sure you can ping www.testing.co.nz and that it points to your computer, not other external servers please.

    By Syahid A. on May 29, 2008

  21. Hi again, can you tell me is the set up for the above the same on windows vista? (just bought a new laptop and its got this rubbish on it!)

    By kim on Jun 22, 2008

  22. @kim: You should try it then. Never tried it on Vista. Not a fan of the OS either. lol.

    By Syahid A. on Jun 23, 2008

  23. if i don’t have a domain name, i can use “localhost” in network name and server name right? would i need to put “localhost” in the hosts file and use the 127.0.0.1 ip address?

    By Darren on Jun 23, 2008

  24. @Darren: I use the one without OpenSSL. Just put up an imaginary domain name at the end of the 127.0.0.1 line. Make sure you can ping it and get a reply.

    By Syahid A. on Jun 23, 2008

  25. Hi again, just to say yes it does work on vista without too much pain either! You cant add your imaginary web name to the host file and so have to use localhost, but everything else works the same! Still cant stand vista but needs must it works! Thanks

    By kim on Jul 1, 2008

  26. just a quick update. Yes you can add your imaginary web name to the host file….. you just need to run notepad in administrator mode! I now have php5, mysql, apache, pear and phpmyadmin all working on vista. Thanks to this tutorial! working on my first content management system!!! eck

    By kim on Aug 13, 2008

  27. @kim: Congrats Kim!

    By Syahid A. on Aug 13, 2008

  1. 3 Trackback(s)

  2. Sep 10, 2007: Beginners Guide: Install PHP 5, MySQL 5 on Apache 2.2 on Windows (with screenshots!) | TechMalaya.com
  3. Sep 12, 2007: Freeware: Manage Your MySQL Database with Web-Based PhpMyAdmin | TechMalaya.com
  4. Jun 9, 2008: How to Setup More Than One Website in a Single, Local Apache 2.2 Installation (with screenshots!)

Post a Comment

Clicky Web Analytics