Cannot change document root

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Cannot change document root

Postby OJello » 25. November 2015 05:13

I am a newbie and am having problems customizing XAMPP document root. This is the
first thing I'm trying to do with the server.
http://www.keynotesupport.com/websites/xampp-apache-tutorial.shtml
I have followed the instructions in this document, creating an Apache Sites folder and
editing the httpd.conf file to
DocumentRoot "C:/Apache Sites"
<Directory "C:/Apache Sites">
However when I access the host I get
"You don't have permission to access / on this server." (403)
I have made no other changes and as far as I can tell this is the default installation
of the server. I get the same result if the Apache Sites folder is empty or if it
contains an index.php file with "hello World". Everything works fine from the default
folder. Any suggestions greatly appreciated.
(running win 7x64 and Server ver 5.5.24 installed in c:\xampplite)
OJello
 
Posts: 6
Joined: 25. November 2015 05:06
Operating System: win 7

Re: Cannot change document root

Postby Altrea » 25. November 2015 06:39

Did you also edit the Directory setting like described in the last three list items?
Double check for any typos
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Cannot change document root

Postby OJello » 25. November 2015 17:24

The directory line is there, quadruply checked.
OJello
 
Posts: 6
Joined: 25. November 2015 05:06
Operating System: win 7

Re: Cannot change document root

Postby Nobbie » 25. November 2015 17:50

Try http://localhost/index.php instead

Also try to put index.html instead of index.php into the DocumentRoot and then try http://localhost

Also look for a .htaccess file in your new DocumentRoot, maybe there is one which denies access.

Finally show us the contents of the <Directory ...> block.
Nobbie
 
Posts: 8775
Joined: 09. March 2008 13:04

Re: Cannot change document root

Postby OJello » 26. November 2015 15:39

Changing to .html or specifying localhost/index.html makes no difference.
index.html is the only file in the Apache Sites folder (is this the problem?)
Here is the contents of the <Directory> block.
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

This is as it was downloaded. No changes.
Hope I'm not doing something really stupid.
OJello
 
Posts: 6
Joined: 25. November 2015 05:06
Operating System: win 7

Re: Cannot change document root

Postby Altrea » 26. November 2015 16:24

This is not the correct <Directory> section.

10. Go back to the top of the file and click at the top of the page so the cursor is at the beginning of the file. Open the Find box if not still visible and type <Directory and click Find Next TWO TIMES. The line above where your cursor should now be located says "This should be changed to whatever you set DocumentRoot to."

11. On the line where your cursor rests, type Apache Sites after C:/ so that the entire line reads <Directory "C:/Apache Sites"> ... don't delete the ending quotation mark or greater-than mark. Cancel the Find box.

12. Click File|Save, and exit out of the Notepad document.

I ask again, did you follow these instructions?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Cannot change document root

Postby OJello » 27. November 2015 04:39

It is obvious that the http.conf file that you have is different from the one I have.
Firstly, when you search for <Directory from the top of the file (hitting Next twice as per instructions)
the cursor is at
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Not at
<Directory "C:/Apache Sites">
That's the next search.
Secondly, the text
"This should be changed to whatever you set DocumentRoot to"
does not occur in this file!!
So, to answer your question, I did not follow those instructions because with the file I have they could not be followed.
Are we talking about the same application?
OJello
 
Posts: 6
Joined: 25. November 2015 05:06
Operating System: win 7

Re: Cannot change document root

Postby Nobbie » 27. November 2015 12:34

OJello wrote:It is obvious that the http.conf file that you have is different from the one I have.


This does not matter. It is (of course!) NOT a question of how often you have to click with a mouse in order to find the appropriate Directory-Clause, instead you have to know WHAT YOU ARE DOING! You must provide some proper options to the folder "C:/Apache Sites" and therefore you have to look for the corresponding <Directory....> Clause. Even if there is NO such clause, you have to create it.

Read the Apache documentation and/or some tutorials about the configuration of Apache, this is not an easy task and this forum is not meant as an replacement for documentation. We all had to take our time and had to read lots of documenation.
Nobbie
 
Posts: 8775
Joined: 09. March 2008 13:04

Re: Cannot change document root

Postby OJello » 27. November 2015 20:45

The problem was a reference to <Directory in httpd-vhosts.conf. I found this from a year old post to stackoverflow.com from someone who had the identical problem.
I find arrogance and condescension of the replies disturbing. As someone new to unix systems I went to "Create a Web Server with XAMPP Lite's Apache HTTP Server" on keynotessupport.com as it seemed appropriate to my level. I followed the instructions for
"Customizing XAMPP Document Root " as exactly as possible. There was no mention of virtual hosts. I was using the default installation so this was certainly an omission.
Perhaps I've been spoiled by twenty years of windows installations, but when I follow simple instructions to to do something as simple as changing a working directory, I expect it to work. When it didn't, rather than plow through dozens of pages of arcane documentation I wouldn't understand at this point just to get the thing running, I decided to post on Apache Friends to get a quick solution. This was clearly a mistake that I will not repeat.
Perhaps your forum should specify a knowledge level requirement!
OJello
 
Posts: 6
Joined: 25. November 2015 05:06
Operating System: win 7

Re: Cannot change document root

Postby Nobbie » 27. November 2015 21:48

OJello wrote:I find arrogance and condescension of the replies disturbing.


As I do when i read "Are we talking about the same application?". This is extremely annoying. Do you really believe that "Altrea" does not know, what he is speaking about?
Nobbie
 
Posts: 8775
Joined: 09. March 2008 13:04

Re: Cannot change document root

Postby Altrea » 27. November 2015 23:07

The funny thing is, YOU are following a foreign tutorial not knowing if it fits your environment, if it is still working and it it is still up to date.
You expect that we can debug the problem you are having with the foreign tutorial with the amount of information you gave us.

But XAMPP does not configure any virtual hosts so a <Directory> block inside a virtual host cannot be an issue unless you have defined virtual hosts by yourself.

Don't blame XAMPP or this board because you are missing to provide important information.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Cannot change document root

Postby OJello » 28. November 2015 05:47

Some humble pie is in order here. I got Xammplite via DesktopServer from ServerPress.com. This was in anticipation
of installing WordPress. It was this installation that created the VirtualHost entry in httpd-vhosts.conf. So you are right.
I cannot expect alien documentation to apply to a specific installation so I humbly apologize for my stroppy attitude!!!
OJello
 
Posts: 6
Joined: 25. November 2015 05:06
Operating System: win 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 33 guests