Apache服务器报错Internal Server Error解决办法记录

沃森博客 2017年12月1日00:15:01服务器评论2,560阅读模式

前段时间去一家公司试岗时,环境搭建完成运行项目时遇到“Internal Server Error”错误,来记录下解决办法,方便下次遇到同样的问题来解决。

报错信息如下:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

apache错误日志如下:

[Wed Nov 29 22:42:59.190888 2017] [core:alert] [pid 4932:tid 796] [client 127.0.0.1:51667] E:/ci/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

Apache服务器报错Internal Server Error解决办法记录

错误原因:

造成此错误的原因是apache没有开启module_rewrite模块,而.htacess里面却进行了rewrite重写操作。

解决办法:

RewriteEngine命令需要rewrite mod模板的支持,在apache中开启此模块后重启服务即可。

1.?打开?httpd.conf

2.找到?mod_rewrite.so?行,将前面的注释打开(即删掉前面的'#'符号)。

3.关闭httpd.conf,重启apache服务器即可。

 

备注虚机配置写法:

<VirtualHost*:80>
 LoadModule rewrite_module modules/mod_rewrite.so
 <IFMODULE mod_rewrite.c>
 RewriteEngine on
 #RewriteBase /
 RewriteRule ^(.*)/shangpinimg/(.*)/(.*)\.jpg $1/shangpinimg/index2\.php\?x=$2&y=$3
 RewriteRule ^(.*)/shangpinimg/(.*)/(.*)\.gif $1/shangpinimg/indexgif\.php\?x=$2&y=$3
 RewriteRule ^(.*)/shangpinimg/(.*)/(.*)\.png $1/shangpinimg/indexpng\.php\?x=$2&y=$3
 RewriteRule ^(.*)/shangpinimg/(.*)\.jpg $1/shangpinimg/index\.php\?x=$2
 </IFMODULE>
 ServerNamewww.taobaoxs.com
 DocumentRoot D:\webhost\taobao
 <Directory "D:\webhost\taobao">
 AllowOverride None
 Options None
 Order allow,deny
 Allow from all
 </Directory>
</VirtualHost>

 

 

沃森博客
  • 本文由 发表于 2017年12月1日00:15:01
  • 本文来自互利网收集整理,问题反馈联系邮箱:wosnnet@foxmail.com,转载请务必保留本文链接:https://wosn.net/842.html

发表评论