apache - 有人可以帮我避免内部服务器错误吗? htaccess | apache2ctl |回溯

标签 apache .htaccess backtrack-linux

我是stackowerflow和apache的新手,如果我把这个线程放在错误的地方,我很抱歉..

有人可以帮我避免内部服务器错误吗? htaccess | apache2ctl |回溯

我想要做的是将这些行添加到 htaccess.. 我的 htaccess 和 webserve 在没有这些行的情况下工作正常.. 但我需要将它们添加到 htaccess

RewriteEngine on
RewriteCond %{REQUEST_METHOD}^(TRACE|TRACK)
RewriteRule .* - [F]

Header set X-Frame-Options Deny
Header always append X-Frame-Options SAMEORIGIN**

一旦我输入上面的行,当我刷新网页时它就会给我这个错误
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.14 (Ubuntu) Server at 192.168.176.130 Port 80

有人可以给一些建议吗?任何帮助将不胜感激...

最佳答案

首先,您需要启用所需的 apache 模块:

a2enmod rewrite headers

然后,在 apache 配置中,只有启用了所需的模块才能执行:
 <IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteCond %{REQUEST_METHOD}^(TRACE|TRACK)
   RewriteRule .* - [F]
 </IfModule>

 <IfModule mod_headers.c>
   Header set X-Frame-Options Deny
   Header always append X-Frame-Options SAMEORIGIN**
 </IfModule>

重新启动您的 Apache 服务器:
service apache2 restart

如果仍然有错误,请执行以下操作:
tail /var/log/apache2/error.log

您将看到详细的错误。

关于apache - 有人可以帮我避免内部服务器错误吗? htaccess | apache2ctl |回溯,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20611893/

相关文章:

apache - 升级到 apache httpd 2.4.25 后,http/2.0 不起作用

php - htaccess 中的 Hash(#) 标签重定向

regex - 用/使用 .htaccess 替换 URL 中的 .php

apache - 使用 .htaccess 从浏览器缓存中排除目录

php - 如何从 cakephp 的 url 中删除操作名称?

ubuntu - 回溯 Linux apt-get 升级错误

linux - dpkg : need an action option

java - Reddit OAuth2 API 循环重定向

apache - 如何重写htaccess规则以重定向到css文件