Virtual Host misconfiguration

NethServer Version: NethServer release 7.5.1804 (final)
Kernel Version: 3.10.0-862.14.4.el7.x86_64
Module: virtualhost / dns

Hi All,
I need your help because have a problem with virtual host module, that I can’t solve.
A time ago, I had created a virtual host for a website. I have used it for many mounts and when I did not need it anymore, I blocked access only to the local network.

Today, after time, I tried to access the site home from the network but I can’t reach it.
I set the access from the public network, but even so, I can’t see the pages of the site.
I only see the apache test page.

I don’t know if it’s a problem that depends only on the virtual host module or even the DNS.
Even at other times I had problems with the dns, this time the restart of the service did not solve the problem.

Is there anyone who can give me directions?

You may check if the virtualhost is active with:

httpd -S

You may also check the virtual host config:

db vhosts show

Hi Markus,
from both commands it appears that virtual host is active.
Now i have setting that virtualhost have public access but i can’t view the site. Only see Apache test page.

Can it depend on some DNS malfunction?

Does nslookup yourvirtualhost.com work on a client?

When you create a virtualhost you are asked if you want to set a DNS server alias entry for the virtualhost. Maybe this entry is not correct anymore?

grafik

You may workaround DNS problems with entering your virtualhost in the clients hosts file and check if it works this way.

But usually if you can see the apache test page the IP should be correct and DNS should work.

I try nslookup myvirtualhost.com but it doesn’t work:
;; connection timed out; no servers could be reached.

Server alias is set and it’s correct!

Even if I set HTTP authentication with a password and update the page I do not see the login form.
This isn’t normal!

Please check the used DNS servers on Nethserver and if the clients use the Nethserver as DNS:

config show dns

The dns settings are the same as when the virtualhost was working. Nothing has changed.
Clients use the same dns

Anything I changed in the virtual host panel has no effect!

That I set public or private or password access doesn’t change anything.
I only see the apache test page!

What I don’t understand: If yourvirtualhost.com can not be resolved, why do you get to the apache page?
Do you browse by entering the IP address?

I don’t browse by entering the IP address but from ‘subdomain.domain.tld’.
I normally see the WordPress site, now the apache test page.

I do not know if it is a problem of DNS or virtual host, the fact is that before I saw the site now no more.

Any changes made in the virtualhost panel have no effect.

If DNS does not work, how can subdomain.domain.tld be resolved? Do you use a proxy server?

Does nslookup subdomain.domain.tld work?

Is subdomain.domain.tld your virtual host name? Because you have to use the correct virtual host name to get the virtualhost pages. And yourvirtualhost.com has to be resolved correctly to the IP of your Nethserver.

The DNS used for the subdomain is external and is the DNS of the university network.
In this DNS, subdomain.domain.tld is registered and points to the IP (red) address of the nethserver hosting it in the virtual host.

If I type subdomain.domain.tld the external DNS resolves and reaches nethserver but does not display the site in WordPress. The virtual host in nethserver is set as public.

And your virtualhost name is correctly entered in the “Virtual host names (FQDN)” field?

grafik

Are the permissions of the vhost ok? Apache has to be the owner.

[root@server2 ~]# ll /var/lib/nethserver/vhost
total 0
drwxr-sr-x 9 apache apache 329 Sep  3 22:21 somename

Yes! The name and permission on vhost are ok.
I have another two vhost set in the panel and i have the same issues on its.

All back to!

The problem has been generated by the alteration of the .htaccess file by a security plugin.

This had already happened to me but I had forgotten it. Sorry :persevere:

I was reminded of why this problem was generated and the solution that at the time was found by @Sebastian and that I linked in this post.

Anyway, thanks Markus for your help and time.

2 Likes