0

I'm facing a configuration issue that's really diving me nuts ...

Basically I'm working as a sysadmin for a customer who use a single server to host many different site, to be more specific:

Server is:

PRETTY_NAME="Debian GNU/Linux 7 (wheezy)" NAME="Debian GNU/Linux" VERSION_ID="7" VERSION="7 (wheezy)" ID=debian ANSI_COLOR="1;31" HOME_URL="http://www.debian.org/" SUPPORT_URL="http://www.debian.org/support/" BUG_REPORT_URL="http://bugs.debian.org/"

Linux xyz 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u6 x86_64 GNU/Linux

Server version: Apache/2.2.22 (Debian) Server built: Aug 18 2015 09:50:52

Now, on top of this I've configured several different web sites at third level, say for example abc.xyz.it, def.xyz.it ghi.xyz.it, and so on. Everything is working as expected until last week I've been asked to configure one of the virtual host to answer to different external query on slightly different URL redirecting them on the same DocumentRoot. It seems quite trivial, in fact I've managed to allow qqq.xyz.it (original virtual host), plus qqqk.xyz.it and www.qqqk.xyz.it putting the expected configuration in the original /etc/apache2/sites-available/qqq file; then a2dissite qqq, service apache2 reload, a2ensite qqq, and again service apache2 reload ...

As I said everything was working with no problem.

But after a couple of days the customer asked me to add also www.qqq.xyz.it ...

My first thought was that it's simply trivial, so I edited the qqq file adding a section also for this instance ... well, despite several trials I was completely unable to make it run ... it seems to me there is nothing different from what I've done for the other virtual hosts, but no success at all.

I paste below the actual content of qqq file:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName qqq.xyz.it
    DocumentRoot /var/www2/qqq
    <Directory /var/www2/qqq>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
#       AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/dri-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel error

    CustomLog ${APACHE_LOG_DIR}/dri-access.log combined
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName www.qqq.xyz.it
    DocumentRoot /var/www2/qqq
    <Directory /var/www2/qqq>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
#       AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/dri-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel error

    CustomLog ${APACHE_LOG_DIR}/dri-access.log combined
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName qqqk.xyz.it
    DocumentRoot /var/www2/qqq
    <Directory /var/www2/qqq>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
#       AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/dri-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel error

    CustomLog ${APACHE_LOG_DIR}/dri-access.log combined
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName www.qqqk.xyz.it
    DocumentRoot /var/www2/qqq
    <Directory /var/www2/qqq>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
#       AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/dri-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel error

    CustomLog ${APACHE_LOG_DIR}/dri-access.log combined
</VirtualHost>

Does anyone have a guess ? I've tried several change in the order of the four section into the file, I've tried to use ServerAlias which doesn't work in any place into the file ... I've run out of ideas, maybe it's a simple stupid thing but as far as I'been trying so long maybe I cannot see it ....

  • 2
    Why even create different vhosts for this? Just use ServerAlias. – jordanm Mar 5 '17 at 21:29
  • In fact I've tried as explained above ... it doesn't work !!!!! I – Davide O. Pandini Mar 6 '17 at 0:36
  • 2
    Did you create DNS records for new zones? What does the command host www.qqq.xyz.it show? – Mikhail Khirgiy Mar 6 '17 at 3:02
0

At first sight this is 2.2, so you are effectively receiving all requests in the first defined virtualhost you need to add this directive once, in server config context for your virtualhosts to be correctly interpreted:

NameVirtualHost *:80

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.