2006-03-18, 02:52 AM
(This post was last modified: 2008-08-09, 06:04 AM by Dennis Tsang.)
Recently, there have been many reports on this forum regarding problems or errors with mod_security, one of the modules loaded into Apache. If you are having problems with error 403 Forbidden or other problems that happen once in a while for quite mysterious reasons, read on and see if mod_security is your problem.
The apparent error that is generated is normally a page saying:
Known problematic pages
Here are a list of known symptoms
Confirm that mod_security is installed on your server
To confirm that the mod_security module is installed on your server, open your PHP Info page (there is one in your forum's Admin CP). Scroll down and find the heading "Loaded Modules" and see if "mod_security" is in the list.
The Solution - MyBB 1.4.x and newer
The htaccess.txt that comes with the MyBB package disables mod_security by default. If you haven't already, rename the htaccess.txt file to ".htaccess" (without the quotation marks, note the leading dot in the filename).
The relevant code is shown below:
The Solution - MyBB 1.2.x and older
Place this code in a .htaccess file in your MyBB folder on the server.
Note, this will disable the security function of the mod_security module for the files inside the MyBB folder. This solution is a tradeoff: security vs usability. Use this solution at your own risk.
If this does not work, then feel free to create a new support thread and we'll try to help you further.
Wiki page: [Wiki: Help:Mod_security] (Broken link, head over to docs.mybb.com instead)
The apparent error that is generated is normally a page saying:
- 500 Internal Server Error
- 403 Forbidden: You don't have permission to access <the file name> on this server.
- Not Acceptable: An appropriate representation of the requested resource <the file name> could not be found on this server.
Quote:[Sat Oct 8 16:33:45 2005] [error] [client 123.456.789.123] mod_security: Access denied with code 403. Pattern match "rcp " at THE_REQUEST. [hostname "www.example.com"] [uri "/forum/admin/templates.php?expand=1&group=usercp"]
Known problematic pages
Here are a list of known symptoms
- Admin CP - Version Check
- Admin CP - Templates Manager - Cannot expand the usercp template group
- Front end - Posting/Editing posts - Message with content similar to harmful commands (example: uname -a)
- The above errors occur when specific data is being requested from the server (example: all the other template-groups work except for usercp templates, and other messages are able to be posted)
Confirm that mod_security is installed on your server
To confirm that the mod_security module is installed on your server, open your PHP Info page (there is one in your forum's Admin CP). Scroll down and find the heading "Loaded Modules" and see if "mod_security" is in the list.
The Solution - MyBB 1.4.x and newer
The htaccess.txt that comes with the MyBB package disables mod_security by default. If you haven't already, rename the htaccess.txt file to ".htaccess" (without the quotation marks, note the leading dot in the filename).
The relevant code is shown below:
#
# If mod_security is enabled, attempt to disable it.
# - Note, this will work on the majority of hosts but on
# MediaTemple, it is known to cause random Internal Server
# errors. For MediaTemple, please remove the block below
#
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
The Solution - MyBB 1.2.x and older
Place this code in a .htaccess file in your MyBB folder on the server.
SecFilterEngine Off
Note, this will disable the security function of the mod_security module for the files inside the MyBB folder. This solution is a tradeoff: security vs usability. Use this solution at your own risk.
If this does not work, then feel free to create a new support thread and we'll try to help you further.
Wiki page: [Wiki: Help:Mod_security] (Broken link, head over to docs.mybb.com instead)