Apache 2.4 不会重新加载,我的配置有问题吗?

shi*_*ish 5 debian apache-httpd

我试图让一个VirtualHost用 Apache 2.2 编写的文件在 Apache 2.4 中工作,虽然我对它做了一些更改,但它没有通过 Apache configtest. 这个想法是在本地测试站点。这是在 Apache 2.2 中显然有效的原始文件:

<VirtualHost local.in2014.mini.debconf.org:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/in2014.mini/website/

    <Directory />
        Options +FollowSymLinks +Includes
        AllowOverride None
    </Directory>

    <Directory /var/www/in2014.mini/website/>
        Options +Indexes +FollowSymLinks +MultiViews +Includes
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这些是我为更改为 Apache 2.4 所做的更改:

$ cat /etc/apache2/sites-enabled/minidebconfindia.conf
<VirtualHost mini:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html/in2014.mini/website

    <Directory />
        Options FollowSymLinks +Includes
        Require all granted
    </Directory>

    <Directory /var/www/html/in2014.mini/website/>
        Options Indexes FollowSymLinks MultiViews +Includes
        Require all granted
    </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

现在我知道我将主机名从大名更改为小名。我也更改/编辑了那里的名称/etc/hosts

$ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    debian mini
Run Code Online (Sandbox Code Playgroud)

我的系统的主机名:

$ hostname
debian
Run Code Online (Sandbox Code Playgroud)

我跑了configtest找出我到底哪里出错了:

$ sudo apachectl configtest
AH00526: Syntax error on line 6 of /etc/apache2/sites-enabled/minidebconfindia.conf:
Either all Options must start with + or -, or no Option may.
Action 'configtest' failed.
The Apache error log may have more information.
Run Code Online (Sandbox Code Playgroud)

现在第 6 行是:

Options FollowSymLinks +Includes
Run Code Online (Sandbox Code Playgroud)

所以从评论看来我需要做的是:

Options +FollowSymLinks +Includes
Run Code Online (Sandbox Code Playgroud)

如果我这样做,那么它也会告诉/要求在第 10 行做同样的事情:

Options +Indexes +FollowSymLinks +MultiViews +Includes
Run Code Online (Sandbox Code Playgroud)

我走对了路吗?

更新 #1

根据@garethTheRed 的建议,我将其修改为以下内容:

$ cat minidebconfindia.conf
<VirtualHost mini:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html/in2014.mini/website

    <Directory />
        Options +FollowSymLinks +Includes
        Require all granted
    </Directory>

    <Directory /var/www/html/in2014.mini/website/>
        Options +Indexes +FollowSymLinks +MultiViews +Includes
        Require all granted
    </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

并重做得到apache2 configtest这个:

$ sudo apachectl configtest
[sudo] password for shirish:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Run Code Online (Sandbox Code Playgroud)

最后一行表明配置文件现在很好。这只是服务器名称/IP 地址似乎是一个问题。我已经分享了/etc/hosts.

我通过在互联网上搜索查看了错误,似乎有一个httpd.conf需要存在/etc/hosts/不可用的错误。我创建了文件并尝试了两件事:

$ cat /etc/apache2/httpd.conf
ServerName localhost
Run Code Online (Sandbox Code Playgroud)

也:

$ cat /etc/apache2/httpd.conf
ServerName mini
Run Code Online (Sandbox Code Playgroud)

但这些都没有奏效,因为我遇到了与上面共享的相同的错误。有人可以帮忙吗?

gar*_*Red 5

来自Option的 Apache 文档:

笔记

将带有 + 或 - 的选项与没有的混合是无效的语法,并且会在服务器启动期间通过带有中止的语法检查而被拒绝。

所以看起来它是全有或全无的+