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

vis*_*hal 1 apache lamp apache2 ubuntu-15.10

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

即使我尝试过以下事情

sudo a2enmode rewrite
apache2ctl configtest // for syantax
apache2ctl -t // for syntax
Run Code Online (Sandbox Code Playgroud)

/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>
Run Code Online (Sandbox Code Playgroud)

/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>
Run Code Online (Sandbox Code Playgroud)

/var/www/opencart/.htaccess

Options +FollowSymLinks
Header add Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteBase /ot
RewriteCond $1 !^(robots\.txt)
Run Code Online (Sandbox Code Playgroud)

vis*_*hal 5

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

sudo a2enmode headers
Run Code Online (Sandbox Code Playgroud)