User avatar
Skraaj
Posts: 29
Joined: Wed Nov 20, 2019 11:35 pm
Contact: Website

Apache2 – Alias problem with FQDN/subpage

Sat Feb 08, 2020 5:02 am

EDIT//

Actually thread can be closed. Found the solution – since Apache 2.4 all aliases need to be configured in

Code: Select all

sudo nano /etc/apache2/mods-enabled/alias.conf
There's a LOT of conflicting information out there :P

-----------------------------------
Hi!

I'm trying to set up services and I've run into trouble with Apache aliases.

What I want to achieve is to have apache serve sites from "FQDN/subpage" instead of using "subdomain.FQDN" since I would have to get a new certificate every time I add a service to the Pi, and apparently wildcard are unobtainable if one is not using a supported DNS

Either on LAN (ip/subpage) and with FQDN/subpage aliased page gives me a 404. Below data is for LAN setup, but using the same on live server does not work as well.

Config:

Code: Select all

<VirtualHost *:80>
        DocumentRoot /var/www/cloud/
        ErrorLog ${APACHE_LOG_DIR}/cloud.log
        CustomLog ${APACHE_LOG_DIR}/cloud_combined.log combined
</VirtualHost>

<VirtualHost *:80>
        Alias "/test1" "/var/www/test1"
        DocumentRoot /var/www/test1
        <Directory "/var/www/test1">
                Require all granted
        </Directory>
        LogLevel trace8
        ErrorLog ${APACHE_LOG_DIR}/test1.log
        CustomLog ${APACHE_LOG_DIR}/test1_combined.log combined
</VirtualHost>
Error log (highest log level available):

Code: Select all

[Sat Feb 08 04:15:50.227269 2020] [mpm_prefork:notice] [pid 3194] AH00163: Apache/2.4.38 (Raspbian) configured -- resuming normal operations
[Sat Feb 08 04:15:50.227902 2020] [core:notice] [pid 3194] AH00094: Command line: '/usr/sbin/apache2'
Error combined (as you can see tried with trailing slash as well and it seems to know that there is "index.html", owner is www-data, for testing I even set chmod 777):

Code: Select all

192.168.0.206 - - [08/Feb/2020:04:16:02 +0100] "GET /test1 HTTP/1.1" 404 496 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
192.168.0.206 - - [08/Feb/2020:04:15:54 +0100] "GET /index.php HTTP/1.1" 302 937 "http://192.168.0.143/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
192.168.0.206 - - [08/Feb/2020:04:16:07 +0100] "GET /test1/ HTTP/1.1" 404 495 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
apachectl -S

Code: Select all

[Sat Feb 08 04:17:28.270813 2020] [core:trace3] [pid 3460] core.c(3355): Setting LogLevel for all modules to trace8
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
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/test.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/test.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/test.conf:7)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
codedoneright.eu – newbie friendly raspberry tutorials

Return to “Networking and servers”