Score:0

After update from Apache 2.2 to 2.4, Aliases no longer work

br flag

I'm not a stranger to server configuration but on my local development systems (all of them), some update seems to have broken the Web sites' aliases as none work now. I'm not sure when it happened as I haven't done much development lately but when I tried, I discovered it was broken so I hope someone can help me get it going again.

This particular system is running Kubuntu but it is also broken on my two Ubuntu Studio systems, all of which are running 22.10 and Apache 2.4.54.

The conf file has this, which in this case was created by Webmin but is much the same as the existing sites that I created manually and I also tried it in the alias.conf file but it made no difference:

<VirtualHost localhost:80>
    DocumentRoot /var/www/html/domain.loc
    ServerName domain.loc
    <Directory "/var/www/html/domain.loc">
        Options None
        Require all granted
    </Directory>
    Alias /common /var/www/html/domain.loc/common
</VirtualHost>

I also tried a slight rearrangement with the Alias farther up and with the paths quoted:

<VirtualHost localhost:80>
    DocumentRoot "/var/www/html/domain.loc"
    ServerName domain.loc
    Alias "/common" "/var/www/html/domain.loc/common"
    <Directory "/var/www/html/domain.loc">
        Options None
        Require all granted
    </Directory>
</VirtualHost>

. . . and I tried it using Location tags:

<VirtualHost localhost:80>
    DocumentRoot "/var/www/html/domain.loc"
    ServerName domain.loc
    <Location "/common">
        Alias "/var/www/html/domain.loc/common"
    </Location>
    <Directory "/var/www/html/domain.loc">
        Options None
        Require all granted
    </Directory>
</VirtualHost>

As a test, I wrote a PHP script which is what I use on my live server for creating aliases and it shows me that the alias already exists so Apache is recognizing it. When it was working, if I went to a URL that included the alias, it would load just as if it were a local file:

http://domain.loc/common/index.php

Now it gives a 404 Page not found and the Apache error log shows nothing.

<?php 

$target = "/var/www/html/common";
$link = "/var/www/html/domain.loc/common";

$error = symlink($target, $link);

if ($error === TRUE) :
    echo readlink($link) . " has been linked";
else :
    echo "<p>The link already exists between $link and $target";
endif;

?>

/common and /domain.loc are, of course, on the same level as indicated in the test script above and mod_alias is installed with a2query -m alias returning alias (enabled by maintainer script)

Any ideas?

Score:1
in flag

The Alias directive provides for mapping different parts of the host filesystem in the document tree.

The following:

ServerName domain.loc
DocumentRoot /var/www/html/domain.loc

is already sufficient to ensure that requests for http://domain.loc/common should show content from the location /var/www/html/domain.loc/common on your file system.

You do not need any variant of Alias for /common to achieve that.
Alias /common /var/www/html/domain.loc/common is completely redundant.

DonP avatar
br flag
As shown in the test script that I posted, `/common` and `/domain.loc` are at the same level, ie: `/var/www/html/common` and `/var/www/html/domain.loc` so not redundant. I've tried about every possible thing posted here and on the mod_alias page of apache.org but to no avail.
DonP avatar
br flag
I'm not sure if this is headway or not but another forum suggested creating the `common` folder as `/var/www/html/domain.loc/common` which I tried but now `the page isn’t redirecting properly`. In the address bar is: `http://sunvirgin.loc/common/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/` even though the site has no such file name.
DonP avatar
br flag
Anybody? Since this is happening on all three of my development PCs after updating to Apache 2.4, I can't be the only one experiencing the issue!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.