5

I'm trying to get a VirtualHost file which was written in Apache 2.2 to work in Apache 2.4 and while I've done some changes to it, it doesn't pass the Apache configtest. The idea is to locally test the site. Here is the original file which apparently works in 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>

These are the changes I did to change to 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>

Now I know that I changed the hostname from a big name to a small name. I changed/edited the name there in /etc/hosts as well.

$ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    debian mini

My system's hostname:

$ hostname
debian

I ran the configtest to figure out where exactly I'm going wrong:

$ 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.

Now line 6 is:

Options FollowSymLinks +Includes

so from the comment it seems I need to do:

Options +FollowSymLinks +Includes

If I do that then it tells/asks the same to do at line 10 as well:

Options +Indexes +FollowSymLinks +MultiViews +Includes

Am I going the right way?

UPDATE #1

From @garethTheRed's advice, I revised it to the following:

$ 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>

and redid the apache2 configtest to get this:

$ 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

The last line tells that the config file is good now. It's only the servername/IP address which seems to be an issue. I have already shared the output of /etc/hosts.

I looked at the error via searching on the internet and it seems there is an httpd.conf which needs to be in /etc/hosts which is/was not available. I created the file and tried both things:

$ cat /etc/apache2/httpd.conf
ServerName localhost

as well as:

$ cat /etc/apache2/httpd.conf
ServerName mini

But neither of these worked, as I'm getting the same error as shared above. Can somebody help?

4

From the Apache documentation for Option:

Note

Mixing Options with a + or - with those without is not valid syntax, and will be rejected during server startup by the syntax check with an abort.

So it seems that it is all or nothing with the +.

0

My original question per-se was about the syntax of my configuration, and it took me quite some time and effort to find:

$ sudo apache2ctl configtest
[sudo] password for shirish: 
Syntax OK

There is another issue/problem I'm grappling with, but that's a question I guess for another day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.