John Bokma Windows tips and tricks
freelance Perl programmer

Comments: Installing and configuring Apache on Windows XP


If you design websites you might want to install a web server on your computer in order to test your sites in an environment that matches the real thing as close as possible. This article describes how to install and configure the open-source Apache HTTP (web) server and how to make it work with not one site but as many as you require using a technique called name-based virtual hosting.

Read the rest of Installing and configuring Apache on Windows XP.


Hi John

Now don't laugh but I am 70 yrs old guy trying to understand this modern technogley. You lesson on Apache is the first I have understood. I am looking forward to your PHP lesson. Thanks for making things more clearer


Posted by Wilf at 19:34 GMT on 16 March 2006

You're welcome Wilf, and I am not laughing, but hoping that I am able to do such things when I am 70.


Posted by John Bokma at 20:23 GMT on 16 March 2006

Just wanted to say thank you for your tutorial it helped me tremendously.


Posted by gf at 14:29 GMT on 31 March 2006

sir, Thanks for making things more clearer.

Posted by sundar at 05:24 GMT on 7 April 2006

Hi John;

Your tutorial on Apache Installation is great!

Thanks a lot.



Posted by boboy at 03:20 GMT on 10 April 2006

I just installed Apache following your instructions. Very easy, indeed.

I am having problems when pointing to http://localhost/cgi-bin/ - I get 500 Internal Server Error.

When I go to command prompt and change directory to C:\Perl\cgi-bin\ and type perl I get response, but not with the browser http://localhost/cgi-bin/


Posted by Daniel at 07:56 GMT on 10 April 2006

For PC security, I have both administrator & limited user accounts on an XP machine. Daily usage is on 'limited' user and all installations & maintenance is done through 'admin' user.

Having searched for 'start stop apache server xp user', ( as I needed to start/stop apache & sql servers logged in as a limited user in WinXP ), I immediately found this article and it answered everything & more.

The 'run as Administrator' fix is so obvious I could kick myself. However, had I not done this search I wouldn't have picked up the tips for directory structuring to mirror my Web Server.

It also shed more light on my Virtual Servers, which currently work fine, but I can now tweak them a little more for ease of future implementation.

My thanks to you and your Apache Help page, John.

Happily running Apache-2.054, MySql-3.23.58, Perl-, php-4.4.0, phpMyAdmin-2.6.2, MySqlCC-0.9.4, Smarty-2.6.9, DreamweaverMX on local Win32 platform for a Unix Hosting Server.

php-5 & MySql-4 currently seem reluctant to work so I must defer to the old adage 'if it ain't broke .... don't fix it'.

regards, Jake

Posted by Jake at 15:50 GMT on 17 April 2006

Forgot to mention in last message :

As far as Windows OS go, I am a Win98 kind of guy.

I reluctantly moved to Win2k in 2002.

I loath XP with a passion and have only just got round to installing it permanently, hence my disbelief at the simplicity of the solution to my problem.

Linux Rocks - hell, anything OpenSource is better than the regurgitated offal from Casa Gates - If only I could do everything I need to from this platform..........

Annyhoo, hope you enjoy your life south of the border...

regards, Jake

Posted by Jake at 16:12 GMT on 17 April 2006

@Daniel: you might want to change the first line of to contain the path to perl.exe. It probably now states:


Changing it to:


does the trick, if on your system this is the path to the perl program as well.

Another option is using:

ScriptInterpreterSource registry

in your configuration file (httpd.conf, or a file you include by adding an Include directive to httpd.conf)

Posted by John Bokma at 19:39 GMT on 17 April 2006

I've made several attempts in the past few years to do this. I've always got caught up with the Apache docs. I think they're written for people with a lot more network knowledge than I have. I've always been able to get the server installed, but tripped up on getting the virtual hosts thing working.

Your article cleared the fog away and I now have it all working. Simple, straightforward and now I know what I missed before.

Thank you!

Although .... even though I took the options you said (or I thought I did) it doesnt run on port 80 - only on port 8080. Is that because IIS was running when I installed? Should I delete Apache again and reinstall or can I reconfigure it?

Posted by Mike Kear at 02:56 GMT on 24 April 2006

@Mike Kear - yes, IIS uses port 80, so Apache won't run on port 80 as well. I have IIS configured to run on port 8080 since I use it only for one project I am developing for a customer.

Apache is used in several projects, so I prefer port 80 for Apache.

Posted by John Bokma at 20:24 GMT on 28 April 2006

Thank you! Thank you! Thank you! You've just saved my life....this is a really great tutorial...

Posted by sorcha at 16:32 GMT on 1 May 2006

I have to say that your site was the first I hit on a google search for setting up a local host server to test webpages before publishing them. Very informative and helpful, as I now have a successfully running apache 2.2 web server hitting the loopback address for all my websites.


Posted by TheSquirrel at 05:09 GMT on 15 May 2006

I got a 500 Internal Server Error

when run perl(pl)of cgi

Any one can help ?

Posted by new boy at 22:34 GMT on 16 May 2006

This is the best article I have read on the subjuct!

However - I still cannot get it to work.

What exactly do I type in the browser to access my local site? For apache's default page, I type http://localhost No problem there.

For my virtual host setup ( I try typing

It wants to connect me to the internet, instead of serving up the page locally. I must be missing something.

Runing apache 1.3.27 on windows xp.

I have followed the instructions to the letter, modifying the httpd.conf and the hosts files. Re-boot.

I did get it to serve up my web site site under "localhost" instead of apache's default page, by removing the virtual host directive for local host.

any help would be appreciated.


Posted by Chris at 22:43 GMT on 26 May 2006

Great tutorial. Thank you very much

Posted by vlad at 01:07 GMT on 27 May 2006

Follow up to my earlier post - IE wants to dial up when I try to access my virtual hosts. I thought my vhost setting were wrong. But I nearly went crazy, because one moment it worked, and the next it did not. And so forth many times over. If I did not connect to the internet, my page would not found (because I was then "working offline").

I will share my solution for anyone else who may bang their heads up against the wall ...

My internet connections setting was the problem "always dial my default connection". Being on dial-up service this is convenient, but problematic. I could not access virtual hosts without being online (the whole point is to be able to access them without being online!) Because I was searching for a solution, I was online, following instructions which seemed to work. Then I would disconnect, go about setting everything up, test, and it wouldn't work!

Solution: change the setting to "never dial a connection". Maybe it's a windows/ IE thing.

Once again, your page is really great, the best I have seen written. Except for this little snafu, it all works beautifully. I am thrilled to finally have this set up properly!

Thank you!

Posted by Chris at 02:59 GMT on 28 May 2006

Thanks. Its a great great tutorial to work with. I installed Apache 2.2 and PHP 5 on Windows XP machine for a testing server. Virtual Host is functioning just fine except that only the first Virtual Host opens up and rest of the domains take me to the first mentioned domain again. I'll try to explain: I've set up 3 domains in hosts file

and I included the right syntax in virtual-hosts.txt file like this

# Use name-based virtual hosting.
NameVirtualHost *:80
<VirtualHost *>
    DocumentRoot "E:/www/mysite1"
<VirtualHost *>
    DocumentRoot "E:/www/mysite2"
<VirtualHost *>
    DocumentRoot "E:/www/mysite3"

All of the above 3 directories exist with contents. But opening any domain takes me to first virtual host (i.e. When I try to browse, it is supposed to take me to the contents of E:/www/mysite3, it doesn't, rather it takes me to the contents of E:/www/mysite1. same is the case when I try to open it takes me to what might be wrong?

Posted by Sana at 19:38 GMT on 6 June 2006

Thanks very much for this - it's the first comprehensible tutorial on this topic I've ever come across!

However, for some reason the method you describe doesn't quite work on my computer, but with a little playing around with hosts and the virtual-hosts.txt file, I managed to get it to work. In case it's of any use to anyone:

I found that if all my virtual hosts were, it would only direct to one of them. However, if I set them up in the 'hosts' file as: localhost

and so on, and then instead of I used , and so on in the 'virtual-hosts.txt' file, then everything worked fine.

Is that a sensible alternative way of doing things, do you think?

(One other thing: I found that it seems I have to close and re-open my browser for it to register changes in the 'hosts' file - worth trying if you're having problems getting things to work).

Once again thanks for a tutorial that finally helped me to do something I've been trying intermittently for weeks to get to work.


Posted by Nick at 00:21 GMT on 7 June 2006

Hi John,

Thanks for a great article. It is easily the most understandable I have come across.

I have a question for you:

In addition to the apache/cgi-bin folder I have an additional cgi script folder for an application in c:/docorg/program/cgi-bin.

I have given permission for cgi scripts to be run from this folder using the following in the httpd.conf file:

<Directory "C:/docorg/program/cgi-bin/">
    Options +ExecCGI
    Allow from all

And have associated the extension .pl with perl.exe in the windows registry. But, although I can successfully run a perl test file in apache/cgi-bin, when I try to run it in docorg/program/cgi-bin it does not work. Instead, it looks as though the browser tries to download something (presumably the file?) and then nothing happens.

Any ideas on what I am doing wrong.

Thanks in advance on any advice you can offer.


Posted by Nick at 10:37 GMT on 13 June 2006

If only this tutorial had been available when I first set up my Apache Server! Very well written and very easy to understand, and great tips on virtual hosting, I can now clean up my conf file. Good tips about keeping the security stuff ABOVE root as well, very sensible advice. PHP advice would be most welcome now as I have never properly used it before.

Posted by Steve at 21:23 GMT on 25 June 2006


I've got the latest Apache installed, and the default localhost message is "It works!". When I try to access I get the same message, even if there isn't a index.html there. BUT when I try to access I get a 403 error.... is this a problem?

Thanks - otherwise a perfect tutorial!

Posted by Richard at 02:39 GMT on 13 July 2006

Hi! Sorryo ther you again...

I've checked the syntax of my virtual hosts file, and when I use

NameVirtualHost *:80

<VirtualHost *>

Apache reports that NameVirtualHost *:80 has no virtual hosts...

Any thoughts?

Posted by Richard (Again!) at 03:13 GMT on 13 July 2006

Dag John, Bedankt voor deze heldere uitleg.

Posted by Kees at 08:22 GMT on 14 July 2006

Hi John,

I am installing Apache into my WIndows XP and I've encountered error messages about the httpd.conf "Os 10048". Something like only one usage of each socket address ..."

I am trying to install Apache and PHP into my XP.

It would be much appreciate it if you could help me.

Kind regards,


Posted by Alvin at 12:18 GMT on 14 July 2006

Hi Alvin,

It sounds like something else is already using port 80. I understand that Skype uses port 80 but there might be other programs as well (for example IIS, the web server of Microsoft).

Posted by John Bokma at 19:11 GMT on 16 July 2006

This is a good tutorial - it will come in handy for many projects - is it possible to install and Dual Boot Apache and IIS?

There seems to be a renewed interested in Dual Booting as of late

Posted by SEARCH Engine WEB at 07:21 GMT on 20 July 2006

@SEARCH Engine WEB - I guess you mean running side by side (dual boot means having the option at start up to select an operating system).

Yes, this is possible. You have to configure either Apache or IIS to use a different port to listen to if they use the same IP address. For example I have Apache using port 80 and IIS using port 8080 on my development machine.

Posted by John Bokma at 20:32 GMT on 30 July 2006

Thanks, the tutorial really helped me installing apache 2.2

Posted by Giambi at 13:09 GMT on 11 August 2006

Hi, John. I am from Malaysia and found your tutorial on configuring Apache HTTP web server. I am using version 2.2. Previously, when i configured it according to the manual from Apache, i cant even view http://localhost/cgi-bin/ , but after i added the ScriptInterpreterSource registry in it. It coulld run. But file with extension .cgi will be downloaded. How can i fix this?

I have added ExecCGI in the root Options directive and AddHandler cgi-script .cgi .pl plus ScriptInterpreterSource registry in cgi-bin directory. Thx

Posted by raymondtan at 01:47 GMT on 17 August 2006

@Sana, Richard - my bad, my original article contained a mistake (fixed now):

<VirtualHost *>

should have been:

<VirtualHost *:80>
Posted by John Bokma at 02:29 GMT on 31 August 2006

hi... i have apache and php installed (latest versions of each). everything works fine locally.

however, when i try to browse some sites online, they will not load. the page simply trys to load and gives no time out error. It seems to be mainly sites that use some form of cgi.

this has only started since i installed and setup apache and php on my machine to use as a localhost. Any ideas on whats' happening?

the hosts file in /drivers just has the localhost url in it.

thanks for any help you may provide!

Posted by jeffro at 22:09 GMT on 1 September 2006

I figured out that Nick's method localhost

works. I had however also have to make a virtual host section for the localhost

<VirtualHost *:80>

    ServerName localhost
    DocumentRoot "C:/my/document-root/"

    ErrorLog logs/localhost.error.log

In addition, in the httpd.conf there is a restriction on which clients (identified by IP-address) might access the document root. I had to widen it:

<Directory "C:/my/document-root">
    Allow from 127.0.0

replace C:/my/document-root with your own document root.

Hopes this helps someone.

Posted by website-ontwikkeling at 19:36 GMT on 29 September 2006


Thanks for posting this great tutorial.

I installed httpd-2.2.3-win32-x86-ssl/php5/mysql at xp release2

the default localhost message is "It works!". When I try to access I get 403 error, even if there is a index.html there.

<VirtualHost *:80>
    DocumentRoot "C:/"
    CustomLog logs/ combined
    ErrorLog logs/

I logged in as admin user. your example is for installing apache_2.2.3-win32-x86-no_ssl. is there anything I missed for httpd-2.2.3-win32-x86-ssl

Thanks again

Posted by Howard at 04:38 GMT on 11 October 2006

Brilliant! This information on the Windows hosts file and virtual hosts was a godsend! If you ever need someone to have your babies, look me up.

Seriously, though, thank you. Cheers!

Posted by Josh at 03:48 GMT on 8 November 2006


I'm trying to migrate from fooling with IIS and ASP, to fooling with Apache, PHP, MySQL, - and Drupal. This has really helped me set up a development environment

Posted by Herb at 19:28 GMT on 17 November 2006


I installed apache as per ur notes but monitor apache server is not starting n its not showing any services to start in services.msc please reply me in this regards. will be waiting

Posted by muzu at 10:32 GMT on 7 December 2006

Hi john,

i installed apache server 2.2.3 installation got completed succesfully and my monitor apache server started successfuly but when i go to start\programm\apache HTTP server\control apache server\start its giving a error (os 10048) please help me in this regards thanks

Posted by muzammil at 11:35 GMT on 7 December 2006

Hi! I am starting out, but there is a newer version of Apache available and I want to use the newer one, but am reluctant to because your tutorial is on an older one...I don't want to start out blind because your tutorial is very detailed...

Posted by Jane at 09:37 GMT on 17 December 2006

Hi! I read your Installing and configurig Apache on Windows Xp (I am using the same version as the one in the tutorial) but I am stuck when it comes to editing the HOSTS file! It will not let me save...when I try to save, via the 'save as' and the normal 'save', it keeps giving me this warning:

Cannot create the C:\WINDOWS\system32\drivers\etc\hosts file" "Make sure that the path and filename are correct."

I checked the HOSTS file's property and such and it is not 'read-only'. Also, when I try to overwrite it or delete it or move it, it says that the file is in use by another person or process...I've tried everything!

Posted by roat at 13:01 GMT on 17 December 2006

OK. I've installed apache2 for my personal web page.

All I want is that visitors are able to see my html pages only.

What can I do?

When I try to access my domain name, the first thing that comes out is the contents of my folder.

I do not want the whole folder to show, just the main html file that I have placed there. Does anybody have an idea how to change this issue? I am running "Apache 2.0.59".

Posted by Jim at 15:55 GMT on 8 January 2007

Hi Jim,

Are you sure that you have an index.html in your folder? When you access a folder using Apache it attempts to use some files first. If none can be found the contents of the folder is shown, or depending on your configuration, an error is returned to the browser.

If you don't have an index.html file in your folder, try to add it and see if everything is working ok.

Posted by John Bokma at 01:50 GMT on 16 January 2007

hello, i read all and also configured virtual host setting for documentroot in "c://program files/apache group/apache 2/htdoc" it worked fine for my server but placing another html at "C;/program files /apache group/apache 2/include" or any else directory it didnt work... plz kindly guide me

Posted by nageen at 16:53 GMT on 26 January 2007

Thanks John,

I had this up and running in less than 10 minutes thanks to your exquisite tutorial. Great work!

Posted by Ron at 11:02 GMT on 31 January 2007

Just to echo the thanks of many others and the congratulations on providing such a clear explanation suitable even for server-novices like myself.

I feel many times more in control than I did a half-hour ago!

Posted by Dan at 12:34 GMT on 31 January 2007

Hi.. John your tutorial is really great. And most importantly, the first apache tutorial that is well explained among the ones I went through..

Posted by Amjath at 16:17 GMT on 2 February 2007

hey there i tried to install apache with ur instructions and stuff... it get installed, but there are some problems

1- i installed, uninstalled, and installed this stuff many times as i was not able to view the test apache server page ( the one we get to see after typing "http://localhost/" , do i get to reinstall windows for this ? or the uninstall though control add and remove programs is well enuff.

2- i saw that blocking and unblock windows pop up first time when i was installing the apache. now when i install it, it doesnt come.

3- the error that it gives when i write the localhost url in the browser is that connection times out. when i remove the proxies and stuff then it says the page cannot be displayed.

i added the test url in bypass proxy option.

nothing is working. plzzzzzzzzzz help

i am using apache 2.0.59

Posted by Bushra at 09:58 GMT on 13 February 2007

I too would like to add my thanks to this excellent tutorial. It's been a huge timesaver for me.

My only problem is getting CGI scripts to work. I noticed at the bottom of this tutorial that you planned to add one for setting up and using CGI. Any idea if/when you're going to do that, or any quick tips you could give me to get started?


Posted by Fern at 15:51 GMT on 13 February 2007

Hello John

Is this going to work Ok with XP Home Edition, just completed a Frontpage course and shown how to load IIS...however XP HE does not support this

Am I doing the right thing?

Many thanks for you help

Posted by Lou at 13:41 GMT on 26 February 2007

@Lou - you might try to install Apache as described in the article.

Posted by John Bokma at 00:23 GMT on 6 March 2007

Thanks John

Great easy to understand tutorial.

I can't wait for you to have one on setting up PHP with Apache, because I have followed other tutorials to the nth degree and it just doesn't happen.

Posted by Lollylegs - Australia at 06:29 GMT on 14 March 2007

In regards to the gentleman (70) who understood your tutorial, I'm 59 and have been a programmer for 35 years, and yours is the first apache tutorial I've fully understood.

Thanks heaps.

Posted by tomk at 08:57 GMT on 3 April 2007

too good i could understand many things.....

thank you very much...

Posted by jeevan at 14:17 GMT on 3 April 2007

Thank you for this Tutorial i was searching about it in search engine finaly i found it here. awesom work !

Posted by Hayssam at 00:57 GMT on 3 May 2007

hi John,

I followed your instructions for installing Apache on Windows XP and created the following virtual hosts:

# default: localhost
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    ServerName localhost
    DocumentRoot "C:/Program Files/ApacheWebServer/Apache2.2/htdocs"
    ErrorLog "logs/localhost.error.log"
    CustomLog "logs/localhost.access.log" combined
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "C:/Documents and Settings/Rob/My Documents/websites/"
    ErrorLog "logs/"
    CustomLog "logs/" combined

localhost works but, when I attempted to go to, I get the following error message:

"You are not authorized to view this page"

Any idea how to fix this? I'm the administrator and only user on this machine.

thanks, Rob

Posted by Rob at 05:56 GMT on 31 October 2007

Hi Rob,

Are you sure you have an index.html in the folder?

Posted by John Bokma at 16:48 GMT on 31 October 2007

After reading through the many comments and solutions, I tried to install apache 2.2.4 to my existing php5.2.1. For 2 hours, a test php file appeared as a request to download.

After having a cup of coffee and restarting the browser, apache 2.2.4 and php 5.2.1 now works fine. I don't know how it will behave tomorrow.

It's no wonder that some people have been mysteriously blessed with additional zeroes by their bank's computers for no particular reason. So for some of you who are facing this problem, just take a beer of something and perhaps the computer might be more cooperative.

And thanks to John for a helpful tutorial.

Posted by Jet at 16:48 GMT on 6 November 2007


Thank you so much for this site. It has been extremely helpful in debugging a cgi-bin issue related to Apache under Windows.

Posted by Richard at 15:18 GMT on 3 January 2008

Very clear. I followed your Apache and PHP and it simply worked. Kudos, kudos. Rare that someone writes so clearly and with good and helpful picks.

I followed your directory structure -- more or less -- and everything was fine until I added a new one. Apache can't seem to find any new virtuals. Stop/Start, of course. Anything I'm missing?

Posted by Oligonicella at 23:43 GMT on 18 January 2008

Sorry, should have told you -- Apache 2, PHP 5.

Posted by Oligonicella at 23:46 GMT on 18 January 2008

i have configure three virtual hosts. and put a index.html file in their document root.

bur when i was trying to open other virtual sites it always Its Works!

Posted by pankaj at 07:37 GMT on 30 January 2008

hi john, iam pankaj again i am pasting here my virtual server config file in reference to my que.

# Use name-based virtual hosting.

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/www1/web "
    CustomLog logs/lc.mysite1.access.log combined
    ErrorLog logs/mysite2.error.log

<VirtualHost *:80>
    DocumentRoot "C:/www2/web "
    CustomLog logs/ combined
    ErrorLog logs/

<VirtualHost *:80>
    DocumentRoot "C:/www3/web "
    CustomLog logs/ combined
    ErrorLog logs/
Posted by pankaj at 07:52 GMT on 30 January 2008

hi pankaj,

Are you sure the configuration file is read? You can test this by making a mistake in the virtual host file, for example just type something like asdfgsasda after NameVirtualHost. If you stop and then start Apache and the latter fails, you are at least sure that the file is read.

Posted by John Bokma at 03:58 GMT on 1 February 2008

It was Skype which blocked the Socket. After stopping Skype I was able to start Apache! Thanks for your help!

Posted by ukraus at 20:35 GMT on 11 February 2008

Thanks for this tutorial John. I have been programming 25 years but only recently started using Apache/PHP and even some JSP and servlets. I had been using htdocs as my development and testing folder which was getting messy with 6 sites to maintain. I now have 7 virtual hosts, I made an extra one for using as a sandbox.

Posted by Tom at 23:24 GMT on 11 March 2008

Hi! I have problem with Perl and Apache 2. I tried to set up a socket using Perl. But the problem is that when I browser to connect.cgi (I programmed for socket), I can not browser to any other file .cgi (Server only stand on the website that I setup for socket)I do not know why? Can anyone help me?

Posted by Rose at 15:44 GMT on 30 April 2008

Let me echo the thanks of others - I am not 70 but still, your tutorial on how to install Apache on Windows XP is the clearest I've found to date, and is leagues beyond the "official" explanation from Apache itself, as well as that in several how-to books I have wasted money on.


Posted by Shyster1 at 19:37 GMT on 1 June 2008

Hi John.

Lets suppose insted of localhost I use an IP like ( made up one not actual )

Here is the general virtual-hosts.conf file:

# Name-Based Virtual Hosting


    DocumentRoot "K:/Program Files/Apache Software

    CustomLog logs/ combined
    ErrorLog  logs/



    DocumentRoot "K:/Program Files/Apache Software

    CustomLog logs/ combined
    ErrorLog  logs/


You do not mention how to access the second virtual host on the Virtual Host List. The first VH on the list is default, but what do I type into the browser to access and summon the second VH?

In the browser I type in or and I get the correct index.html page to appear for the default( VH.

Question: How do I get to the correct index.html page for the second ( VH?

The following are guesses that do not work. I have attempted to type into the browser:

Your help and guidance to finish off the tutorial you provided would be greatly appreciated.



Posted by Ed at 02:23 GMT on 24 August 2008

Hi John.

I got the index.html for the second ( Virtual Host to come up in the browser.

Through trial and error, the proper index.html came up by typing into the browser.

Is there a special code to include when using the IP Address to make it go to the second ( Virtual Host? Example like error Example like error

The index.html for the first ( VH appears when I type:,,

How can I use the IP to get at



Posted by Ed at 03:30 GMT on 24 August 2008

Hi Ed,

The whole point of the domain names is that you can use those instead of the IP address. If you have added them to your hosts file, you should be able to use them like any other domain name, i.e.:
Posted by John Bokma at 18:29 GMT on 28 August 2008

Hi friends,can anyone help me how to use apache webserver in RAD STUDIO 2007,since am new to my seniors are asking me to configure Apache instead of IIS server but am not able to configure apache as my webserver....Please help me!!!!!.

Thanks in Advance

Posted by KK at 11:29 GMT on 29 September 2008

Hi John,

I must concur with the others on your excellent and straightforward setup. Mine installation of Apache 2.2 is now complete after one pesky error.

Like some I encountered a 403 error. Yes I had an index.html file in my DocumentRoot, and everything else double and triple-checked to be correct. Perhaps something changed with v2.2, but I had to add a Directory section for my DocumentRoot in httpd.conf. I just copied the block for the ...Apache2.2/htdocs directory, changed the path to my virtual server's DocumentRoot, and voila!

Thank you again!

Posted by Michael at 04:02 GMT on 3 December 2008

@roat: re saving the "hosts" file and getting the constant "save as" and not being able to save it: I had this problem once, and it turned out to be caused by ZoneAlarm, a personal firewall which I use. You need to look for advanced options, and untick the option to "lock the hosts file", and this will allow you to save the hosts file.

@Michael: yes it appears something did indeed change in Apache2.2 and a section allowing access to the documentroot directory for your virtualhost seems to be the way to prevent endless "403 Forbidden" errors.

Posted by Tim Benjamin at 09:08 GMT on 7 April 2009

Further to my previous comment, the config change in Apache2.2 seems to be:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

In previous Apache versions this, I believe, was simply:

<Directory />
    Options FollowSymLinks
    AllowOverride None

The solution is either to have a directive inside your , or to change the master directive to remove the "Deny from all" setting. This is probably fine on a local development machine but it will have security implications on a live server.

Posted by Tim Benjamin at 09:29 GMT on 7 April 2009

hey i dont know if anyone still answers comments here but i have a question...if use apache with xampp...and it was installed with xampp...and its not working(the same server specific error comes up)..should i do the same thing as in this tutorial?

i know its abit out there but am not good at finding help in net..:)


Posted by trizzy at 21:51 GMT on 11 April 2009

Thanks a lot for the wonderful tutorial. I am trying to run the apache on my w2k3 server. Can you please advice some usefull links so that I can setup on w2k3.....Thanks

Posted by manny at 15:12 GMT on 10 September 2009

Thanks! it's a well structured and informative guide to get apache running locally. I've book-mark your site...

Posted by Steen - Denmark at 13:31 GMT on 10 March 2010

Hi John Exceptional tutorial on virtual hosting. Have also scoured all the post before deciding to post this. I have followed all your instruction but still encountered 403 msg when typing ''

    DocumentRoot "C:/myweb/"

index.html located at the "web" directory I also followed one of your post to check if the conf file is being read by placing garbage text and restarting the apache and it did display an error. Hope you still visit this site cause your last post is almost a year ago. Thanks.


Posted by don at 13:16 GMT on 18 February 2011

fantastic - much appreciated!

Posted by toy at 01:42 GMT on 15 March 2011

this is the best in www thanks a lot

live long

Posted by Jagadeesh at 08:32 GMT on 5 June 2011

I had to do chmod 777 to both files to get rid of internal server error

Posted by kalpesh soni at 22:16 GMT on 28 June 2011

I'm trying to install and configure apache with PHP in windows. I've installed Apache 2.2.19 and PHP 5.3.6. When I go to localhost I just get a welcome picture that when I click on it, it takes me to Why is this? I also can't get apache to start. I get an error message windows could not start apache 2.2 on local computer. I've tried telling it to listen to a different port and nothing works. Can anyone help?

Posted by cv at 00:26 GMT on 21 July 2011

Hi John,

thanks for the extremely helpful report.

I got like some others above a 403 error with Apache 2.2.19, and also have an .index in the directory.

Funny enough after some wrong trials with the vritual host, Im start getting a 403 error also with localhost ...

I will appreciate any answer.

Posted by Rovoro at 13:43 GMT on 27 July 2011

Hello John,

I just googled the answer to the previous question:

Supposed in virtual_host.conf there is: [code] ServerName bar.localhost DocumentRoot "F:/bar/public" [/code]

Than in httpd.conf it should be

<Directory "F:/bar/public">
    AllowOverride All
    Order Allow,Deny
    Allow from All
    # Any other directory-specific stuff


Posted by Anonymous at 14:20 GMT on 27 July 2011

Thanks for the tutorial. I'm trying to set up a home website and this was the first article that showed up in my search.

Posted by fireflies at 19:17 GMT on 16 September 2011

Hi great page but little help needed please.

I have the following:

Directory with index.html in: [code] D:\My Documents\Websites\Dale Powell\\site\web [/code]

I have virtual-hosts.conf stored in: [code] C:\Program Files\Apache Software Foundation\Apache2.2\conf [/code]

and contains:	localhost			# my company's site

# Use name-based virtual hosting.
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "D:/My Documents/Websites/Dale Powell/"
    CustomLog logs/ combined
    ErrorLog logs/

and finally I have httpd.conf stored in above location and have added the following to the bottom of the file:

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
# Note: The following must must be present to support
#	starting without SSL on platforms with no /dev/random
#	but a statically compiled-in mod_ssl.

#Include conf/virtual-hosts.conf

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

When i type in browser i get the url

What am I doing wrong, I feel so close for my virtual domain to wrok??? :)

Posted by dpuk44 at 22:32 GMT on 11 October 2011

@dpuk44: the hosts should be in your hosts file not the virtual-hosts.conf file. Moreover, there should be no # in front of the Include. Remember, if a line starts with a # it's considered a comment, so putting it in front of a command disables the command by turning it into a comment.

Hope this helps.

Posted by John Bokma at 18:17 GMT on 25 October 2011

Post a comment

Note that your comment doesn't show up immediately. I review each comment before I add it to this site.

Check the Follow this page option if you want to receive an email each time a comment is posted to this page, including yours. A link to turn this option off will be included with each email.

Internet adresses will be converted automatically. You can use the following notation to specify anchor text for a link: [url=]example text[/url].