Solved Apache24 refuses connection

Code:
root@Bender:/var/log # uname -a
FreeBSD Bender 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64

Code:
root@Bender:/var/log # pkg info | grep apache
apache24-2.4.54                Version 2.4.x of Apache web server

Trying to get my apache24 server going so I can host some things (Nextcloud, Wordpress). I have an account at GoDaddy that hosts the DNS for me and it points at the correct IP.
Code:
root@Bender:/var/log # host XXX.org
XXX.org has address x.x.x.152

I am using Name-Based Virtual Hosts due to the fact that a friend of my would also like to run an instance of PHPBB3 with his own domain.
When I use my phone (no wifi connection) and use the domain name it stalls and says connection refused.
However, when I use the IP I get the DocumentRoot I specified in the Virtual hosts config file...

This is what I see on the server when I use the domain name from outside the network on my phone, so I know the port forwarding is fine
Code:
root@Bender:~ # tcpdump -v -i em0 port 80
tcpdump: listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
...
4 packets captured
69 packets received by filter
0 packets dropped by kernel
And this is what I get when I use the IP from outside the network which correctly lands me in the document root
Code:
root@Bender:~ # tcpdump -v -i em0 port 80
tcpdump: listening on em0, link-type EN10MB (Ethernet), capture size 262144 bytes
..
470: HTTP, length: 470
        GET / HTTP/1.1
        Host: x.x.x.152
        Connection: keep-alive
        Cache-Control: max-age=0
        DNT: 1
        Upgrade-Insecure-Requests: 1
        User-Agent: Mozilla/5.0 (Linux; Android 13; SM-S908U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36
        Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
        Accept-Encoding: gzip, deflate
        Accept-Language: en-US,en;q=0.9

17:28:01.831968 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 486)
    192.168.1.10.http > 18.sub-174-238-129.myvzw.com.5211: Flags [P.], cksum 0xf38b (incorrect -> 0xe44b), seq 1:435, ack 470, win 1041, options [nop,nop,TS val 3712307742 ecr 3423819935], length 434: HTTP, length: 434
        HTTP/1.1 200 OK
        Date: Mon, 09 Jan 2023 22:28:01 GMT
        Server: Apache/2.4.54 (FreeBSD) PHP/8.0.25
        Content-Length: 213
        Keep-Alive: timeout=5, max=100
        Connection: Keep-Alive
        Content-Type: text/html;charset=ISO-8859-1

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
        <html>
         <head>
          <title>Index of /</title>
         </head>
         <body>
        <h1>Index of /</h1>
        <ul><li><a href="XXX.root"> XXX.root</a></li>
        </ul>
        </body></html>
...
10 packets captured
38 packets received by filter
0 packets dropped by kernel



My Files...

Code:
root@Bender:/usr/local/etc/apache24 # cat httpd.conf
...
ServerRoot "/usr/local"
...
Listen *:80
...
#ServerName 192.168.1.10
ServerName XXX.org
...
DocumentRoot "/mnt/hdd10tb/www"
<Directory "/mnt/hdd10tb/www">
...
    Options Indexes FollowSymLinks
...
    AllowOverride None
...
    Require all granted
</Directory>
...
    #
    # Php80 file handlers
    #

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

# Virtual hosts
Include etc/apache24/extra/httpd-vhosts.conf
...
Include etc/apache24/Includes/*.conf

Code:
root@Bender:/usr/local/etc/apache24 # cat ./extra/httpd-vhosts.conf
...
<VirtualHost *:80>
    DocumentRoot "/mnt/hdd10tb/www/XXX.org"
    ServerName XXX.org
    ServerAlias www.XXX.org
    ErrorLog "/var/log/XXX.org-error_log"
    CustomLog "/var/log/XXX.org-access_log" common
</VirtualHost>
 
Can’t see anything obvious but looks like Apache doesn‘t realise that it should be delivering for that host name.

Traceroute from outside to see where it goes? Does it end up at the expected IP?

Can you access the site on the server itself using the host name? If no, what if you try a hosts file entry (just to test).

Beef up logging on Apache to see if you can find out where the request is going.

Any firewalls etc to check logs (doesn’t seem likely if using the IP itself works).

Can‘t see anything in your post where Apache is refusing connections as such? More that the virtual host is not working.
 
Can’t see anything obvious but looks like Apache doesn‘t realise that it should be delivering for that host name.

Traceroute from outside to see where it goes? Does it end up at the expected IP?

Can you access the site on the server itself using the host name? If no, what if you try a hosts file entry (just to test).

Beef up logging on Apache to see if you can find out where the request is going.

Any firewalls etc to check logs (doesn’t seem likely if using the IP itself works).
It ends up at the correct IP using both the IP and the Domain Name as indicated by the tcpdumps above. So, the routing is fine, and the port forwarding is fine... I haven't put a firewall on it yet so there isn't even that to contend with... Internally (192.x.x.x) I get the site to come up with both the IP and the Domain.
 
Ok. so it turns out everyone in the world can get it except me on my phone... Well, I can't get it on CHROME on my phone. But, the Samsung browser and EVERY COMPUTER IN THE WORLD can access it just fine...
 
Back
Top