错误提示

在使用openSUSE15安装YouPHPTube的时候被一个Apache2.4的语法给折腾的死去活来的,LAMP配置好以后,死活无法访问,提示

Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500
192.168.30.229
Apache

查询日志

apache2日志显示

[Thu Nov 15 12:13:20.770044 2018] [core:alert] [pid 41136] [client 192.168.30.36:50130] /srv/www/htdocs/youphptube/.htaccess: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration, referer: http://192.168.30.229/
[Thu Nov 15 12:13:20.889031 2018] [core:alert] [pid 41131] [client 192.168.30.36:50131] /srv/www/htdocs/youphptube/.htaccess: Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration, referer: http://192.168.30.229/

查看.htaccess发现里面大量使用了apache2.2的语法,即

<Files routes.php>
Order Allow,Deny
Deny from all
</Files>
<Files PayPal.log>
Order Allow,Deny
Deny from all
</Files>
<Files youphptube.log>
Order Allow,Deny
Deny from all
</Files>
<Files youphptube.js.log>
Order Allow,Deny
Deny from all
</Files>

解决问题

#Apache2.2语法
Order Allow , Deny
Deny from all
#Apache2.4语法
Require All granted

经大量Google搜过得之
apache2.4为了兼容2.2语法,需要开启authz_host模块,但openSUSE默认已经开启了,但为什么还是不能识别呢,原因是还要开启一个mod_access_compat

sudo a2enmod mod_access_compat

安装完Apache2之后需要手动操作的有

sudo a2enmod php7
sudo a2enmod rewrite
sudo a2enmod mod_access_compat

扩展阅读

stackoverflow帖子

发表评论

电子邮件地址不会被公开。 必填项已用*标注

2 × 1 =