Cannot connect to named based virtual host

Hi, I’ve set up two sites on apache2 named based virtual host on opensuse leap 15.1. I think they have been set up correctly as I can access them from localhost. However, when I try to access them from another machine on the local network, by entering server name in address bar, they cannot be reached. If I were to enter the static address of the wireless card in the address bar the first site can be reached.
There is clearly a name resolution problem. I do not know how to resolve this problem. Can somebody point me in the right direction. I have tried to solve issue by modifying DNS configuration, in Yast2, but if I enter public DNS such as Google’s 8.8.8.8 it does not solve problem plus I cannot access internet from localhost. The router is hyperoptic ZTE H298N. I wonder if anyone could help me. All suggestions would be greatly appreciated.

DId you add the ip address and hostname to the /etc/hosts file?
Are we talking about a FQDN?

DNS will only help without a FQDN if you run a local DNS server and add the server’s hostname.

Hello, Thank you for your reply.
Yes, ip address and hostname were added to [LEFT]/etc/hosts file.
I am not using FQDN. I am only using [FONT=Verdana]dNS domain name for ServerName, as in somewebsite.com[/FONT][/LEFT]

You mean the /etc/hosts of the “another machine on the local network”?[/LEFT]

For machine that has openSUSE with apache server installed and a wireless card, in [LEFT]/etc/hosts file I have added static ip address of wireless card and server name. I am trying to access that apache server from a windows 10 machine that does not have any server running.[/LEFT]

Hi
Unless you have a real FQDN out on the internet, or a local DNS server, easiest way is to use the static ip address or add it to the windows hosts file Windows/System32/drivers/etc/hosts.txt, need to run the likes on notepad as Administrator. Format is the same as Linux, ip address fqdn fqdn -s.


XXX.XXX.XXX.XXX somehost.some.domain somehost

So not on the client system?

How do you think that a client system can resolve a host name (FQDN) when it

  • can not find it using DNS;
  • does neither has it itself in it’s /etc/host file (or what the equivalent may be in Windows)?

Even systems are not clairvoyant.

Assuming a Windows 10 host, you might try using Bonjour/Avahi name resolution via mDNS. For example, I can reach a Linux host on my LAN using ‘https://nas01.local’ or my CUPS server ‘https://linux-server01.local:631

If I were to interpret what you wrote exactly which I highlighted in red , that’s your problem.

So, the question is…
Did you actually access your websites by either either an ip address bound to an address starting with 127.0.0.x, or a named instance bound to a localhost address?
If you did that, the named instance would not be accessible from another machine because those IP addresses are specially reserved to be accessible only from the same machine.

The solution should be to bind your named instances to a “network address” which is different from a “localhost address”
A common class C network address starts with and has the numbers and with “x” and “y” some other number.

192.168.x.y

BTW - You can install a YaST Module which can help you set up your Apache webserver properly… You can either use YaST Software Manager or zypper to install the following package

yast2-http-server