在Apache 2.4上启用PUT和DELETE方法 [英] Enable PUT and DELETE methods on Apache 2.4
问题描述
我想在Linux下的Apache 2.4上启用PUT和DELETE方法.当客户端尝试调用此类方法时,我得到"405不允许的方法"作为答案.
I'd like to enable on my Apache 2.4 under linux the PUT and DELETE methods. When clients try to invoke such methods I get a "405 Method Not Allowed" as answer.
在服务器端,我的PHP脚本处理了此类请求,但似乎被服务器本身过滤了(这与已经回答的类似问题有所不同-而且其他问题似乎都指向Apache的旧版本).
On server side my PHP script handle such requests but it seems filtered by the server itself (that's makes the difference from the similar already answered question - Moreover other questions seems to refers to an old version of Apache).
我可以管理.htaccess文件上的某些配置还是必须修改/etc/apache2下的.conf文件?
Can I manage some configurations on .htaccess file or I have to modify the .conf files under /etc/apache2?
非常感谢.
推荐答案
尝试在服务器上进行以下更改:
Try the following changes on your server:
打开"/etc/httpd/conf/httpd.conf"并查找以下块:
Open "/etc/httpd/conf/httpd.conf" and look for the following blocks:
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow Deny from all
</LimitExcept>
然后仅在PROPFIND之后添加PUT和DELETE.然后通过"/sbin/service httpd restart"重新启动httpd或服务httpd重新启动.
Then just add PUT and DELETE after PROPFIND. Then Restart httpd by "/sbin/service httpd restart" or service httpd restart.
注意:在某些服务器中,大多数是带有控制面板(DA,cPanel,..)的服务器,您可以更改此文件:/etc/httpd/conf/extra/httpd-directories.conf
Note: In some servers , mostly the ones with a control panel (DA,cPanel,..) you may change this file :/etc/httpd/conf/extra/httpd-directories.conf
希望它能解决您的问题.
I hope it solves your problem.
这篇关于在Apache 2.4上启用PUT和DELETE方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!