apache2 在 AllowOverride All 之后抛出内部服务器错误 500,localhost

apache2 is throwing internal server error 500 after AllowOverride All, localhost

我是配置服务器的新手。现在,我必须使用 LAMP 和 opencart 框架配置本地主机。但它仍然抛出内部服务器错误 500。

连我都试过以下的东西

sudo a2enmode rewrite
apache2ctl configtest // for syantax
apache2ctl -t // for syntax

/etc/apache2/sites-available/000-default.conf 文件

    ServerName localhost

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/
    <Directory "/var/www/">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

/etc/apache2/apache2.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

/var/www/opencart/.htaccess

Options +FollowSymLinks
Header add Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteBase /ot
RewriteCond  !^(robots\.txt)

检查日志后,我发现参数无效headers。因此,为此我们必须这样做:

sudo a2enmode headers