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?