Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

lamp - Enable PUT and DELETE methods on Apache 2.4

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.

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).

Can I manage some configurations on .htaccess file or I have to modify the .conf files under /etc/apache2?

Thanks a lot.

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

Try the following changes on your server:

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>

Then just add PUT and DELETE after PROPFIND. Then Restart httpd by "/sbin/service httpd restart" or service httpd restart.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...