Apache的403错误(禁止)在Windows [英] Apache 403 error (Forbidden) on windows
问题描述
我使用Apache和发送使用jQuery从 index.html的
Ajax请求。在 get_data.pl
是的cgi-bin
的文件。我得到了 403 Forbidden错误
。任何人都会帮助我,在此先感谢。
I'm using Apache and send an ajax request using jQuery from index.html
. The get_data.pl
is a file on cgi-bin
. I got 403 Forbidden error
. Anyone would help me and thanks in advance.
$.ajax({
async : true,
type: "GET",
url: "get_data.pl"
}).done(function(msg){
alert("Data Saved: " + msg);
}).fail(function(xmlHttpRequest,statusText,errorThrown) {
console.log(JSON.stringify(xmlHttpRequest));
console.log(statusText);
console.log(errorThrown);
});
我从控制台得到了什么:
What I got from the console:
{"readyState":4,"responseText":"<!DOCTYPE ...<title>403 Forbidden</title>...
<p>You don't have permission to access /get_data.pl\non this server.</p>\n</body>
</html>\n","status":403,"statusText":"Forbidden"}
这是Windows 7中我使用的是管理员帐户与Chrome的运行。
It's Windows 7. I'm running with Chrome using administrator account.
一段时间后,我没有找到这个问题的方法呢。我觉得我应该提供更多的细节专家重现我的问题。
关于我的httpd.conf中,我改变的基础上原来的地方:
193线:
After some time, I didn't find ways for the issue yet. I think I should provide more details for experts to reproduce my problem. About my httpd.conf, I changed places based on the original one: Line 193 in:
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
我删除2行:
Order allow,deny
Allow from all
343线:
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
我改变了这一节:
I changed this section to:
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Allow from all
</Directory>
我把特等文件中的cgi-bin文件夹中,在index.html的htdocs文件夹。
我试过的Windows7,WIN2K3 64位和32位WIN2K3。所有房间都禁止错误。我用Apache的默认printenv.pl也。
I placed the .pl file in cgi-bin folder, the index.html in htdocs folder. I tried Windows7, Win2k3 64bit and WIn2k3 32bit. All have forbidden errors. I used Apache's default printenv.pl also.
推荐答案
我认为你缺少的权限运行 CGI
的东西,你可以阅读有关如何启用它 Apache文档
I think you are missing permissions to run CGI
stuff and you can read about how to enable it in the Apache documentation
在卖出看跌期权这样的事情在你的主配置文件( https.conf
)
In short put something like this in your main config file(https.conf
) :
<Directory /path/to/cgi-bin/>
Options +ExecCGI
AddHandler cgi-script .pl
</Directory>
希望它可以帮助你前进。
Hope it helps you forward.
修改
的问题是,用于访问该脚本的路径是不正确的。日志文件显示选项ExecCGI是关闭此目录中:C:/ Program Files文件(86)/ Apache软件基金会/的Apache2.2 / htdocs中/ get_data.pl
,而 get_data.pl
文件不在的htdocs
,而在的cgi-bin $ C $ 。C>文件夹修改
解决了这个问题。 URL:get_data.pl
在 AJAX
打电话找到<$ c中的脚本$ C>的cgi-bin
EDIT
The problem was that the path used to access the script was incorrect. Log file showed Options ExecCGI is off in this directory: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/get_data.pl"
while the get_data.pl
file is not in htdocs
, but in cgi-bin
folder. Changing url: "get_data.pl"
in the ajax
call to locate the script in cgi-bin
solved the problem.
这篇关于Apache的403错误(禁止)在Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!