Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up my first Apache server on my Windows PC at home and I have real trouble finding out which configuration settings go where. I downloaded and installed XAMPP which seemed to get everything nicely set up and can see a working website on http://localhost. So far so good.

The point of this is to develop a website of course, and to make my life easier (irony?), I wanted to let the web site root point to my Eclipse project folder. So I opened httpd-vhosts.conf, uncommented a VirtualHost block and changed its DocumentRoot to my local path.

Now when I try to load http://localhost I get a 403 (Access denied) error. So where do I configure permissions for my folder? And is that all I need to let my site run from the folder specified or am I going to have to clear another hurdle?

Update: I tried to simplify things a little, so I reinstalled XAMPP and got back to a working http://localhost. Then I confirmed that httpd-vhosts.conf is included in httpd.conf and made the following changes to httpd-vhosts.conf:

  1. Uncommented the line NameVirtualHost *:80
  2. Added a virtual host shown below. Restarted Apache and saw the expected page on http://localhost

    <VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/"
      ServerName localhost
      ErrorLog "logs/dummy-host2.localhost-error.log"
      CustomLog "logs/dummy-host2.localhost-access.log" combined
    </VirtualHost>
    
  3. I then created a new folder named C:\testweb, added an index.html file and changed the DocumentRoot line shown above. For all intents and purposes I would then expect the two configurations to be equivalent. But this setup gives me an error 403.

  4. Even though the C:\testweb folder already had the same permissions as the C:\xampp\htdocs folder, I then went further and gave the Everyone group full control of C:\testweb and got exactly the same problem.

So what did I miss?

share|improve this question

migrated from webmasters.stackexchange.com Mar 7 '11 at 12:50

This question came from our site for pro webmasters.

    
"I'm trying to set up my first Apache server on my Windows PC at home and I have real trouble finding out which configuration settings go where." Seriously? Did you check google? –  iainlbc Mar 8 '11 at 23:45
    
It's trivial when you know what setting you're looking for, but - and this is quite basic - googling doesn't work well for specific issues that you don't know how to describe. Try googling for something like "setup apache windows" and see if any of your results show settings I don't describe in my post and then come back here to criticise. Thanks for the snarky but useless comment. –  Cobus Kruger Mar 9 '11 at 6:53

2 Answers 2

I hope i have understood your problem. But i think you make it a bit complicated.

you want only set your DocRoot to another folder right?

Then go to "C:/xampp/apache/conf/httpd.conf

Browse to line 215 i hope its the same i don't know which version you have. There is a directory with the MainRoot.

#
# This should be changed to whatever you set DocumentRoot to.
#    
<Directory "C:/xampp/htdocs">

There is a helpful comment over the line. When you set this to "C:/testweb/" then you can access over http://localhost/index.html and its not really good to change values in the registry.

I hope had understood your question correct.

Edit:

For a new VHost you need at first a new domainname go to "C:\windows\system32\drivers\etc\hotsts" set there a new Domainname like:

127.0.0.1    new.localhost.com

Then you can create the vhost with your configuration and set the ServerName to new.localhost.com i think then it should work.

share|improve this answer
    
It works! But this does still kill of my fancy virtual host setup. How do I get it to work with multiple sites? Or do I just set Directory to whatever the root of all the sites would be? –  Cobus Kruger Mar 8 '11 at 23:20
    
I have edited my post with a new line for your vhost @Cobus Kruger –  Stony Mar 8 '11 at 23:33
    
I got that part, thanks. But when I setup the vhost, does that DocumentRoot then need to be a subfolder of the Directory setting you show in your answer? Put another way, can Apache only access the directory specified there? –  Cobus Kruger Mar 9 '11 at 6:56

If i'm not mistaken, Apache has it's own directory of folders it creates when you load it on your machine. You could technically point your Eclipse project folder to there and access it that way. As far as sharing is concerned on the original folder you are asking about, you should be able to Right click the folder, go to properties, then a sharing tab, click share and add yourself as a user with full control. This depends on what version of windows your running also, but ideally its similar from XP to 7.

share|improve this answer
    
I'm trying to access it on my own machine here, so I'm not sure I understand your statements about sharing. I need to get permissions somehow to access the folder through Apache, I think. In IIS, I would give the IIS user permissions on that folder, which would in turn make it accessible to users of the site. Something similar in Apache? Or dissimilar? –  Cobus Kruger Mar 7 '11 at 13:22
    
Yeah i understand it's on your machine. Yes it's something similar in Apache, the process your thinking of. Can you verify if the installation was used for all users or just the your account (or current user). For group navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Apache Group\Apache\2.0.43 and for user HKEY_CURRENT_USER\SOFTWARE\Apache Group\Apache\2.0.43 see which one has a key in it. I know you said the file name path was coded into the httpd.conf but verify it's the correct path and you have permissions to that folder for full control basically. –  Split71 Mar 7 '11 at 13:53
    
I don't see either key, actually. There is an xampp key under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\xampp, and I suspect that's what you referred to. I now tried to simplify my test a bit and will try to edit the original post. But because it was moved from the webmasters site, I may not be able to. We'll see. –  Cobus Kruger Mar 8 '11 at 20:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.