Home > Net >  .htaccess cgi perl - Invalid command 'Deny', perhaps misspelled or defined by a module not
.htaccess cgi perl - Invalid command 'Deny', perhaps misspelled or defined by a module not

Time:07-03

i'm trying to set up this: https://github.com/oprel/emanon But everytime i try to run post.cgi i receive this error on the error log:

[Sat Jul 02 13:03:13.380647 2022]
/fs5d/9kun/public/board/.htaccess: Invalid command 'Deny', perhaps misspelled or 
defined by a module not included in the server configuration

The 'Invalid command' is from .htaccess:

<FilesMatch "\.(txt|pm)$">
deny from all
</FilesMatch>

Lines 3,4,5 What should i do?? I run apache with cgi.

CodePudding user response:

I would expect you are on Apache 2.4

<FilesMatch "\.(txt|pm)$">
deny from all
</FilesMatch>

Deny is an Apache 2.2 (and earlier) directive and is formerly deprecated on Apache 2.4 and moved (from a base module) to mod_access_compat (an optional extension). This module is probably not enabled, hence the error.

You should be using the corresponding Require directive on Apache 2.4 instead. For example:

Require all denied

Reference:

CodePudding user response:

The problem is that you are not ordering the statement at all, therefore Apache has no idea whether you want to deny or allow it. Try this below...

<FilesMatch "\.(txt|pm)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>
  • Related