Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
552 views
in Technique[技术] by (71.8m points)

xampp - I get Access Forbidden (Error 403) when setting up new alias

I'm running windows 7 and recently installed XAMPP to build a dev environment. I'm not great with the server side of things so I'm having some problems setting up an alias for a project.

So far XAMPP is running and if I go to localhost I get the XAMPP welcome page. I created an "alias" folder in my "conf" folder of my apache install. In there I added dev.conf with the following content:

<Directory "C:Usersmy_userMy%20DocumentsAptana%20Studio%203%20Workspaceproject">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from 127.0.0.1
</Directory>

Alias /dev "C:Usersmy_userMy%20DocumentsAptana%20Studio%203%20Workspaceproject"

But then when I go to "localhost/dev" I get:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

I tried googling and I found other similar questions on SO but I can't seem to figure it out. Some say that you have to tell it to have permissions but in my conf file I specified to allow it from 127.0.0.1. Maybe this is because my path has spaces in it (though some googling told me %20 work). I had managed to create one to a different folder and copy pasted the working one and changed the alias and path and it broke so it this tells me it probably has something to do with either.

I looked in my log folder and found the following line:

[Tue Dec 13 14:59:20 2011] [error] [client ::1] client denied by server configuration: C:/Users/my_user/My%20Documents

I'm not sure if it cuts because error messages can only be of a certain length but that's definitely not the path I added in the dev.conf file, I'm hoping this can make this a bit clearer for some because I am getting pretty frustrated and I'm not sure what to try anymore.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I just found the same issue with Aliases on a Windows install of Xampp.

To solve the 403 error:

<Directory "C:/Your/Directory/With/No/Trailing/Slash">
   Require all granted
</Directory>

Alias /dev "C:/Your/Directory/With/No/Trailing/Slash"

The default Xampp set up should be fine with just this. Some people have experienced issues with a deny placed on the root directory so flipping out the directory tag to:

<Directory "C:/Your/Directory/With/No/Trailing/Slash">
   Allow from all
   Require all granted
</Directory>

Would help with this but the current version of Xampp (v1.8.1 at the time of writing) doesn't require it.

As for op's issue with port 80 Xampp includes a handy Netstat button to discover what's using your ports. Fire that off and fix the conflict, I imagine it could have been IIS but can't be sure.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...