简体   繁体   English

不能接受的! 在此服务器上找不到所请求资源的适当表示。 此错误是由 Mod_Security 生成的

[英]Not Acceptable! An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security

I'm new to moodle environment and I'm having this error:我是 moodle 环境的新手,我遇到了这个错误:

Not Acceptable!不能接受的!

An appropriate representation of the requested resource could not be found on this server.在此服务器上找不到所请求资源的适当表示。 This error was generated by Mod_Security.此错误是由 Mod_Security 生成的。

I haven't done anything, I'm just viewing the registered users in my website:我什么都没做,我只是在我的网站上查看注册用户:
http://www.joyfementira.com/dnsc/it14lms http://www.joyfementira.com/dnsc/it14lms
I've noticed that my profile picture is not properly loaded so I clicked on it (picture's position), and after that the error came out.我注意到我的个人资料图片未正确加载,因此我单击了它(图片的位置),然后出现了错误。

What probably caused this error and how would I fix it?可能是什么导致了这个错误,我将如何解决它?

I was experiencing same issue with my WP site shared-hosted in HostMonster.我在 HostMonster 中共享托管的 WP 站点遇到了同样的问题。 I resolved simply by accessing to the server via SSH and added the following lines on the .htaccess file :我只需通过 SSH 访问服务器并在 .htaccess 文件中添加以下行即可解决:

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

Just to add to the answers.只是为了补充答案。 If this happens while you are trying to login to a WordPress website admin and you are using any type of VPN on your machine, you'd have to turn it off to solve the problem.如果在您尝试登录 WordPress 网站管理员并且您在计算机上使用任何类型的 VPN 时发生这种情况,您必须将其关闭以解决问题。

If you turn off your VPN, you'd be able to login without experiencing the issue.如果您关闭 VPN,您将能够登录而不会遇到问题。

Apache has a mod_security tool that tries to block SQL injections by url. Apache 有一个 mod_security 工具,它试图通过 url 阻止 SQL 注入。 This rule is also blocking some real urls.此规则还阻止了一些真实的 url。 The solution is:解决方案是:

  • access WHM in your dedicated server在您的专用服务器中访问 WHM
  • search for mod_security tools搜索 mod_security 工具
  • check if it's blocking some urls检查它是否阻止了一些网址
  • click in the rule id点击规则ID
  • click in deploy and Restart Apache单击部署并重新启动 Apache

if you don't have access to WHM in your server.如果您无权访问服务器中的 WHM。 Pass this issue to your server administrator.将此问题传递给您的服务器管理员。


This is the rule that was blocking my urls这是阻止我的网址的规则

SecRule REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer "\b(\d+) ?= ?\1\b|\'\"[\'\"] ?= ?[\'\"]\2\b" \ "phase:2,capture,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:replaceComments,t:compressWhiteSpace,t:lowercase,ctl:auditLogParts=+E,log,auditlog,msg:'SQL Injection Attack',id:'959901',tag:'WEB_ATTACK/SQL_INJECTION',logdata:'%{TX.0}',severity:'2'" SecRule REQUEST_HEADERS|XML:/*|!REQUEST_HEADERS:Referer "\b(\d+) ?= ?\1\b|\'\"[\'\"] ?= ?[\'\"]\2\b " \ "phase:2,capture,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:replaceComments,t:compressWhiteSpace,t:lowercase,ctl:auditLogParts=+E,log,auditlog,msg:'SQL注入攻击',id:'959901',tag:'WEB_ATTACK/SQL_INJECTION',logdata:'%{TX.0}',严重性:'2'"

This error will appear in some sites if cookies are turned off and mod_security requires cookies to match session data.如果 cookie 被关闭并且 mod_security 要求 cookie 匹配会话数据,此错误将出现在某些站点中。 It is suppossed to make things more secure... it ends up just annoying.它应该让事情更安全......它最终只是烦人。 Especially because web indexing crawlers like googleBot and other search engines do not use cookies, so THEY see this error instead of your site.特别是因为像 googleBot 和其他搜索引擎这样的网络索引爬虫不使用 cookie,所以他们看到这个错误而不是你的网站。

Do you have experience in setting up servers?你有设置服务器的经验吗? Is this hosted by yourself or is it a shared hosting package?这是您自己托管还是共享托管包?

The reason I ask is because this is a server-side (Apache) issue.我问的原因是因为这是一个服务器端(Apache)问题。

First, make sure your .htaccess file doesn't have any silly rules in it.首先,确保您的 .htaccess 文件中没有任何愚蠢的规则。 The error arises because the server is denying access.出现错误是因为服务器拒绝访问。

Second, make sure your file permissions are set up correctly.其次,确保您的文件权限设置正确。 Generally speaking, you want directories to be 7/0/0 or 7/5/0 and files to be 6/0/0 or 6/4/0.一般来说,您希望目录为 7/0/0 或 7/5/0,文件为 6/0/0 或 6/4/0。

Read this for more details on Moodle security guidelines.阅读本文以获取有关 Moodle 安全指南的更多详细信息。

As for the profile picture issue, I'm not entirely sure what you're referring to so unfortunately I'm unable to answer that question.至于头像问题,我不完全确定你指的是什么,所以很遗憾我无法回答这个问题。 I doubt the two issues are related from the sounds of things.我怀疑这两个问题是否与事物的声音有关。

I'm writing scripts to communicate from one server to another and I don't own either servers and cannot change any settings.我正在编写脚本以从一台服务器到另一台服务器进行通信,我不拥有任何一台服务器,也无法更改任何设置。 I was getting the Not Acceptable error with some embedded URLs but not others.我收到了一些嵌入的 URL 的 Not Acceptable 错误,但没有其他的。 For example this one gets Not Acceptable: http://magic.kayaker.net/simlink.php?avname=http://junk.com While this one does not: http://magic.kayaker.net/simlink.php?name=http://junk.com (fails whether I escape the query or not) The second one gets an unknown command, which is an error my script generates, the first one returns the not acceptable without ever running my php script.例如这个不可接受:http://magic.kayaker.net/simlink.php?avname=http: //junk.com而这个没有:http: //magic.kayaker.net/simlink.php ?name=http://junk.com (无论我是否转义查询都失败)第二个得到一个未知命令,这是我的脚本生成的错误,第一个返回不可接受的,而没有运行我的 php 脚本。 My solution has been to strip the http:// off all URLs and have the scripts on both ends put it back on.我的解决方案是从所有 URL 中去掉 http://,然后让两端的脚本重新打开。

In my case, I received this error when sending to viewer file wrong path to the file it needed to view.在我的情况下,当我向查看器文件发送到需要查看的文件的错误路径时,我收到了这个错误。

err: example.com/subDir/myViewer.php?file=%27../../myImages/myFile.gif%27
fix: example.com/subDir/myViewer.php?file=%27../myImages/myFile.gif%27

It had the same problem when enter a link in a form.在表单中输入链接时也有同样的问题。 It's is not the http:// or https://它不是 http:// 或 https://

In the form i had以我的形式

<input type='text' name='demo'>

The name='demo' wasn't accepted anymore. name='demo' 不再被接受。 I altered name='demo' into name='link' and solve it.我将 name='demo' 更改为 name='link' 并解决了它。

Most of the time this error occurs due to location.大多数情况下,由于位置而发生此错误。 in my case, that was also an IP issue.就我而言,这也是一个IP问题。 Use any FREE VPN to fix this issue for a permanent solution you can contact your hosting provider to white list your IP .使用任何FREE VPN来解决此问题以获得永久解决方案,您可以联系您的托管服务提供商将您的IP列入白名单。

I had the same error when submitting a form to insert values into a database.提交表单以将值插入数据库时​​,我遇到了同样的错误。 The issue was that one of the form inputs was a link (with https).问题是表单输入之一是链接(带有 https)。 Once I took that input out, the error stopped showing up.一旦我把那个输入拿出来,错误就不再出现了。

Anyone can help me out? 有人可以帮我吗? This is the message I get when I try to send the script for YELP reviews button: Not Acceptable! 这是我尝试发送YELP评论按钮的脚本时收到的消息:不可接受! An appropriate representation of the requested resource could not be found on this server. 在此服务器上找不到所请求资源的适当表示形式。 This error was generated by Mod_Security.\\ 此错误是由Mod_Security生成的。\\

...In my case I was trying to save a Wordpress menu, with a link that pointed to #process (a div´s ID)...changed the #process to #ourprocess and it worked... ...在我的情况下,我试图保存一个 Wordpress 菜单,其链接指向#process(一个 div 的 ID)...将 #process 更改为 #ourprocess 并且它有效...

pretty strange if you asked me, but as real as it gets, I was able to replicate the issue more than 10 times.如果您问我,这很奇怪,但尽管如此,我能够将这个问题复制 10 次以上。 It is definitely the URL of the link that is blacklisted...绝对是被列入黑名单的链接的URL...

so, if you are using Wordpress in a shared hosting (in my case is Bluehost) it could be this... or something similar.所以,如果您在共享主机中使用 Wordpress(在我的情况下是 Bluehost),它可能是这个......或类似的东西。

如果这是在 WordPress 上,您只需要联系您的托管服务提供商,他们会将您的 IP 列入白名单

For me it was a missing Content-Type header in my Insomnia requests!对我来说,这是我的 Insomnia 请求中缺少Content-Type标头!

Shout out to this blog post:大声喊出这篇博文:

https://clay-atlas.com/us/blog/2021/10/17/wordpress-en-not-acceptable-mod-security/ https://clay-atlas.com/us/blog/2021/10/17/wordpress-en-not-acceptable-mod-security/

在请求中使用 HTTP 标头有助于我的情况 headers = {'user-agent': ...} requests.get(url, headers=headers)

Encountered same issue today.今天遇到同样的问题。

I was trying to access wordpress admin dashboard with browsec vpn turned on.我试图在打开 browserc vpn 的情况下访问 wordpress 管理仪表板。

I turned it off and issue was resolved in seconds.我把它关掉了,问题在几秒钟内就解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在此服务器上找不到所请求资源的适当表示。 这个错误是由 Mod_Security 产生的 - An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security POST 数据时是什么导致 mod_security 406 Not Acceptable? - What causes mod_security 406 Not Acceptable when POSTing data? 在此服务器上找不到请求的资源/。 Laravel on Cloud9 IDE - The requested resource / was not found on this server. Laravel on Cloud9 IDE 未找到 在此服务器上未找到请求的 URL。 xampp 错误 - Not Found The requested URL was not found on this server. xampp error 404错误-在此服务器上找不到请求的URL / &lt;。 为什么? - 404 error - The requested URL/< was not found on this server. why? 错误:在此服务器上找不到请求的 URL /login。 (Laravel) - Error: The requested URL /login was not found on this server. (Laravel) 大文件上传时出现 Apache 错误 500 (mod_security) - Apache error 500 on large file uploads (mod_security) apache mod_security说-访问被拒绝错误 - apache mod_security says - Access Denied error 网址中带有“〜”字样的Mod_security 406 - Mod_security 406 with a '~' in the URL 在此服务器上找不到请求的资源 - The requested resource / was not found on this server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM