在 Apache 2.4 上启用 PUT 和 DELETE 方法 [英] Enable PUT and DELETE methods on Apache 2.4
问题描述
我想在 Linux 下的 Apache 2.4 上启用 PUT 和 DELETE 方法.当客户尝试调用此类方法时,我得到405 Method Not Allowed"作为答案.
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"或service httpd restart重启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屋!