Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Empty pages with No-IP domain name |
|
Author |
|
jdbukowski
Joined: 30 Jan 2023 Posts: 2 Location: USA, Philadelphia
|
Posted: Sat 04 Feb '23 6:16 Post subject: Empty pages with No-IP domain name |
|
|
I haven't posted this in Networking because No-IP says it's a configuration error on my part.
I'm looking for suggestions on how to troubleshoot the following problem.
Setup: Apache v.2.4.54 on Raspberry Pi 2+ running Raspbian "bullseye" (latest version) in my home LAN. Domain name from No-IP.com.
Problem:
I am in the process of setting up my apache server but it mostly fails to serve HTTP requests when using a domain name.
I think I have a basic configuration problem, but I have not been able to solve it. The problem may be related to the port configuration required to get around blocked ISP ports. I am using No-IP.com for a domain name, and I am forwarding port 80 to 8080 for my No-IP DNS configuration, and listening to 8080 in apache.
The apache DocumentRoot uses the default of /var/www/html. That directory contains the apache sample page index.html and a test page testpage.html.
My problem is that a request for a page using my IP works, but using the domain name fails, except for the root.
From my home LAN or from the internet I get the same results:
http://24.xx.xx.xx:8080/index.html # succeeds
http://24.xx.xx.xx:8080/testpage.html # succeeds
http://example.ddns.net # serves index.html, shows 24.xx.xx.xx:8080 in address bar
http://example.ddns.net/index.html # serves empty page
http://example.ddns.net/testpage.html # serves empty page
My ISP blocks incoming ports 80 and 443, so I have configured apache's ports.conf to also listen on ports 8080 and 8443:
Code: | Listen 80
Listen 8080
<IfModule ssl_module>
Listen 443
Listen 8443 https
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
Listen 8443 https
</IfModule>
|
I also added *:8080 to the default VirtualHost declaration in /etc/apache2/sites-available/000-default.conf.
My router is configured to use a static LAN IP (192.168.0.xx) for the Pi, and to forward ports 8080 and 8443 to that IP.
No-IP setup:
My ISP uses dynamic IP for my home line, so I have made an account on No-IP with a host name (example.ddns.net, not the real name) and I am running their DUC software on a Windows machine to periodically update No-IP with my router's dynamic IP (24.xx.xx.xx). My ISP is not using CG-NAT.
Because my apache webserver is listening to HTTP on port 8080 I have configured the No-IP account to use port 80 redirect to 8080.
Additional information:
I don't know if the failures are due to a configuration issue in apache or a problem with No-IP. Looking at the access.log, I think I sometimes see a 408 timeout associated with the empty pages, so maybe the request is being dropped by the client for some reason.
In case it was necessary, I made a Virtual Host .conf file (example.ddns.net.conf) and enabled it:
Code: | <VirtualHost *:80 *:8080>
ServerName example.ddns.net
DocumentRoot /var/www/html
</VirtualHost>
|
However, from the testing so far I don't think apache is even receiving the host name in a HOST header, so I don't think this helps anything.
The apache error.log noted that it couldn't determine the server's FQDN from 127.0.0.1, so I made a local .conf file and enabled it, with the entry
Code: | ServerName example.ddns.net:80
ServerName example.ddns.net:8080
| but this didn't help and pages still are empty.
I consulted No-IP and they believe the problem is on my end. I don't know enough on how to diagnose the problem so I would appreciate any suggestions for troubleshooting. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 07 Feb '23 11:12 Post subject: |
|
|
Once you add a VirtualHost the "default host" from httpd.conf no longer works. You have to add a default VirtualHost as a catch-all host.
example:
Code: |
<VirtualHost _default_:80>
# ...
</VirtualHost>
|
You can check your host config via httpd -S
Code: |
C:\Apache24\bin\httpd -S
|
|
|
Back to top |
|
jdbukowski
Joined: 30 Jan 2023 Posts: 2 Location: USA, Philadelphia
|
Posted: Thu 16 Feb '23 5:28 Post subject: |
|
|
Thank you for the help.
I ran 'apachectl -S' and it provided the following output:
Code: | VirtualHost configuration:
*:8080 is a NameVirtualHost
default server example.ddns.net (/etc/apache2/sites-enabled/000-default.conf:1)
port 8080 namevhost example.ddns.net (/etc/apache2/sites-enabled/000-default.conf:1)
port 8080 namevhost example.ddns.net (/etc/apache2/sites-enabled/example.ddns.net.conf:1)
*:80 is a NameVirtualHost
default server example.ddns.net (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost example.ddns.net (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost example.ddns.net (/etc/apache2/sites-enabled/example.ddns.net.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: 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 not_used
Group: name="www-data" id=33 not_used
|
With No-IP I believe that requests to the webserver are arriving with the IP in the HOST: header instead of the domain name, and I suspected the presence of the FQDN in every virtual server was a problem, so I then rolled back the change I had made to add the servername.conf file (to define the FQDN). apache2ctl -S then gives:
Code: | 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 this message
VirtualHost configuration:
*:8080 is a NameVirtualHost
default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 8080 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 8080 namevhost example.ddns.net (/etc/apache2/sites-enabled/example.ddns.net.conf:1)
*:80 is a NameVirtualHost
default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost example.ddns.net (/etc/apache2/sites-enabled/example.ddns.net.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: 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 not_used
Group: name="www-data" id=33 not_used
|
The requests using the domain name then worked (with No-IP redirecting them to the WAN IP of 24.*.*.*).
Reading up on apache configuration, the documentation seems to suggest that the first virtual host I defined should work as default since it has a wildcard IP. So I reenabled the servername.conf file and the server still works. I'm not sure why requests failed before, but I think everything is ok now.
Thanks again for your help! |
|
Back to top |
|
|
|
|
|
|