All Domains open the Default website page instead of the URL requested

Okay, here goes. I’ve searched the web and found references to the issue, but can’t fix with the referenced documents.

Problem: All domains open the same “Default website for IP address” (henceforth called “Default website…”) virtual server.

Operating system Debian Linux 7; Webmin version 1.680; Virtualmin version 4.06.gpl GPL; Theme version 8.7

Changing the “Default website…” in the Server Configuration -> Website Options changes the website that is displayed.

The access_log/error_log entries always show up on the “Default website…” files.

The access_log/error_log entries always show the domain name that was requested, not the “Default website…” domain.

So this seems like it means the FQDN is being passed to Apache correctly, and the Apache system is handing the “default website…” incorrectly, no?

So what am I missing? What do I need to configure or unconfigure?

andreychek suggested looking at https://www.virtualmin.com/documentation/web/troubleshooting, here’s the results of what I found. I broke it up into sections, to mirror the suggested ideas in the document.


No NAT. Skipped this section.


ifconfig v web site IP addresses

ifconfig

root@blackseam:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:89:2f:ad
inet addr:162.244.24.29 Bcast:162.244.24.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe89:2fad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1625849 errors:0 dropped:17911 overruns:0 frame:0
TX packets:853295 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:175946827 (167.7 MiB) TX bytes:151734940 (144.7 MiB)

Then I grepped all the Virtual Host IP addresses like this:

grep “<VirtualHost” /etc/apache2/sites-enabled/*

root@blackseam:~# grep “<VirtualHost” /etc/apache2/sites-enabled/*
/etc/apache2/sites-enabled/000-default:
/etc/apache2/sites-enabled/blackseam-com.conf:<VirtualHost 162.244.24.29:80>
/etc/apache2/sites-enabled/blackseam-tk.conf:<VirtualHost 162.244.24.29:80>
/etc/apache2/sites-enabled/marksatterfield-tk.conf:<VirtualHost 162.244.24.29:80>

They all show up as the same IP address, 162.244.24.29 … except the first one, which shows up as

/etc/apache2/sites-enabled/000-default:

I looked into the 000-default a little, and the Directory is the /var/www/ directory. It is not the web page that shows up. The web page that shows up is whatever I select as “default” within Virtualmin, and I can change it to whichever of the three that I have registered.

Per the link you provided, “You would want to make sure that IP address is your server’s primary IP.”

All of the IP addresses are the same as the server’s primary IP address
None of the IP addresses list an asterisk


Network interface for virtual addresses - This is automatically detected by Virtualmin during the configuration check, but could be detected incorrectly, if you have multiple physical interfaces, or your system is some virtualized system like a vserver or Zone or OpenVZ instance. You would typically want this to be the primary IP address of your server – in most cases that is “eth0”.

My host is some kind of virtualized server, but I don’t know which one. That said, eth0 is the one that shows up for ifconfig, so I think it is okay.

eth0 Link encap:Ethernet HWaddr 00:50:56:89:2f:ad
inet addr:162.244.24.29 Bcast:162.244.24.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe89:2fad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1625849 errors:0 dropped:17911 overruns:0 frame:0
TX packets:853295 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:175946827 (167.7 MiB) TX bytes:151734940 (144.7 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:191652 errors:0 dropped:0 overruns:0 frame:0
TX packets:191652 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:21988638 (20.9 MiB) TX bytes:21988638 (20.9 MiB)


Okay, as one may expect, operator error.

Short answer: Confirm that the domain name is exactly the name of the domain that is referenced, including dots and dashes.

Longer answer:

Because I will be hosting .coms, .nets, and other tlds – some of which would be the same base name – I thought it would be clever to identify the name as “example-com” and “example-net”, etc. The way the system normally works is if example.com is entered, the username is just example. I considered, what would happen with the .net, et al, since the username example would already be used.

Not a good idea.

The domain name has to be exactly the name that is referenced. Then you can change the username associated with that domain. For example:

Domain: example.com; User example-com
Domain: example.au; User example-au

Hope this helps someone.