0

As said in the title, I discovered yesterday that all my virtual hosts are redirected to the last (alphabetically, if it matters) virtual host.

I have been checking, and did not see any changes made recently to the different .conf files, and I do NOT use .htaccess

I am on Ubuntu. Everything looks right in my settings. Like I said, I did not change anything lately there.
I just noticed that on the last apt-get upgrade (or apt-get dist-upgrade) there was a question about updating some configuration in Apache2. I asked to see the comparison, did not looks like anything regarding Virtual hosts, so I said OK.

Anybody has an idea where I should look at, or, how could I roll back that very recent Apache upgrade?

Thanks for your help, I am puzzled by this one.

Here is an example:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName ecritsduchateau.fr
    ServerAlias www.ecritsduchateau.fr
    DocumentRoot /var/www/ecritsduchateau/public_html
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/>
            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 All
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/ecrits_du_chateau_error.log

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

    CustomLog ${APACHE_LOG_DIR}/ecrits_du_chateau_access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>

I have been checking with Fiddler, to see if it would give me some hints. Here is the raw answer:

HTTP/1.1 301 Moved Permanently
Date: Thu, 21 Apr 2016 17:59:26 GMT
Server: Apache/2.4.20 (Ubuntu)
X-Pingback: http://lebearcnc.com/xmlrpc.php
Location: http://lebearcnc.com/
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

If it helps you to see a reason, great, as it does not help me much.... :-)

7
  • Can you post a virtual site config? Blank out any information you don't want shared.
    – user508889
    Commented Apr 20, 2016 at 23:01
  • in /etc/apache2/apache2.conf, is there a line at the end with IncludeOptional sites-enabled/*.conf? Also when you access ecritsduchateau.fr, does an entry get logged in the ${APACHE_LOG_DIR}/ecrits_du_chateau_access.log log file (I recommend running curl ecritsduchateau.fr to test this, as your browser might have cached the 301 redirect already)?
    – Dan
    Commented Apr 21, 2016 at 18:31
  • Yes, IncludeOptional sites-enabled/*.conf is there, but the only access log file modified is the one for lebearcnc.com.
    – BernardG
    Commented Apr 21, 2016 at 18:57
  • @BernardG The fact that there is no log in ecrits_du_chateau_access.log, this means that the virtual host is not being loaded at all. Make sure that the site is enabled sudo a2ensite ecritsduchateau and the restart apache.
    – Dan
    Commented Apr 28, 2016 at 18:09
  • Hi Dan, thanks for pointing me in the right direction. I finally found the reason, and the correction was easy. See my answer to myself.
    – BernardG
    Commented Apr 30, 2016 at 4:20

1 Answer 1

2

I finally found the proper answer to that problem, and it was indeed linked to a recent Ubuntu update.

When I tried to do as Dan suggested, sudo a2ensite ecritsduchateau, I got the error Site does not exist while I knew it was there, I was looking at it!

So I searched for that error, to find the answer here: Stack Overflow: Site does not exist error for a2ensite

In a nutshell, a recent upgrade of Apache 2.4.x make the .conf extension mandatory, which I had not put on a couple of my sites definitions.

As soon as I fixed this and reloaded Apache2, everything went back to normal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .