I have a red hat system that I currently have to websites hosted on. I’m trying to set up a third domainname but every time I touch the files (httpd.conf, hosts, ddclient.conf, VirtualHosts,etc) it resolves to the primary domain name. The third domain keeps pulling up my first domain instead of resolving to it’s domain name. Any Ideas? I go through DynDns with custom domains. The first two have been working for years, but whenever I try to set up the third one exactly like the other two using the thirds info, it will not resolve to that third domain?????
zoeymae 0 Newbie Poster
Dani AI
Generated
Symptom described by —new domain always serving the primary site—almost always comes down to either DNS not resolving to the intended host or Apache receiving the request but not finding a matching VirtualHost, so it falls back to the default site (as suggested). The quick path to a solution is: confirm DNS from outside the server, confirm the dynamic update actually set an A/AAAA record for the custom name, then confirm Apache has a loaded vhost whose ServerName/ServerAlias exactly matches the Host header and the correct IP/protocol (IPv4 vs IPv6).
Quick checks (run from a remote machine, not the server):
dig +short third.example.com
dig AAAA +short third.example.com
nslookup third.example.com Apache/host configuration checks (on the server):
# syntax + vhost listing
apachectl -t
httpd -S # on RHEL/CentOS; apachectl -S on some systems
# simulate request to see which vhost responds
curl -I -H "Host: third.example.com" http://PUBLIC_IP Things that commonly cause the fallback behavior:
- The custom DynDNS/registrar record wasn’t updated or is a provider redirect/CNAME instead of an A record; confirm the public IP shown by your DNS matches the server’s public IP.
- The vhost file isn’t included or has a syntax error (use
apachectl -tandhttpd -Sto verify what Apache actually loaded and which vhost is the default). - IPv6: an AAAA record can send the browser to IPv6 while vhosts are only defined for IPv4.
- Local overrides or NAT:
/etc/hostsentries, router port-forwarding to a different internal host, or a reverse proxy in front of Apache. - SELinux or filesystem permissions if the document root is nonstandard (check
ls -Zand audit logs).
Check ddclient logs or the provider control panel to ensure the custom hostname’s A record points to the right IP. With DNS confirmed and the correct ServerName/ServerAlias present in a loaded vhost, the third domain will stop returning the primary site.
rch1231 169 Posting Shark
You either need to used fixed addresses (not really an option using dynamic DNS) or to set up virtual hosting in Apache. Below are the first three domains on one of my servers running as virtual domains on the same IP address. The lines starting with # are comments and I use them to remind me of what is needed. The singel NameVirtualHost *:80 tells the server to use the next entry as the default for the IP address or unspecified domain.
NameVirtualHost *:80
#<VirtualHost *:80>
# ServerAdmin webmaster@chartwriter.com
# DocumentRoot /var/www/html/default
# ServerName chartwriter.com
# ErrorLog logs/chartwriter.com-error_log
# CustomLog logs/chartwriter.com-access_log common
#</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@chartwriter.com
DocumentRoot /var/www/html/chartwriter.com
ServerName chartwriter.com
ServerAlias www.chartwriter.com
ErrorLog logs/chartwriter.com-error_log
CustomLog logs/chartwriter.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@txlinux.com
DocumentRoot /var/www/html/txlinux.com
ServerName txlinux.com
ServerAlias www.txlinux.com
ErrorLog logs/txlinux.com-error_log
CustomLog logs/txlinux.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@fortworthjazz.com
DocumentRoot /var/www/html/fortworthjazz.com
ServerName fortworthjazz.com
ServerAlias www.fortworthjazz.com
ServerAlias www.dfwjazzfestival.com
ServerAlias dfwjazzfestival.com
ErrorLog logs/fortworthjazz.com-error_log
CustomLog logs/fortworthjazz.com-access_log common
</VirtualHost> Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.