有人可以帮我避免内部服务器错误| htaccess | apache2ctl |原路返回

时间:2013-12-16 13:16:32

标签: 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

有人可以请一些建议吗?任何帮助都将受到高度赞赏......

1 个答案:

答案 0 :(得分:10)

首先,您需要启用所需的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

你会看到详细的错误。