Nethserver Vhost

NethServer Version: 7.6
Module: vhosts
Experience: Nethserver - Noob, Linux - experienced Beginner
I don’t know what i’m doing wrong but i created a new virtual host using the WebGUI. When I subsequently go to the vhost’s sub.domain.tld it just shows the main index.html in /var/www/html instead of the index.html I placed in /var/lib/nethserver/vhost/sub. Are you supposed to do some additional steps not mentioned in the Docs?

Check DNS with nslookup sub.domain.tld

Returns my Server’s external IP

Try adding an alias name of your server name into DNS -> alias
Put into field the address of your vhost and check the resolution with nslookup and if it works.

When i created the vhost it auto-added an alias.

What do you mean the adress of my vhost into which field? There are only 2 fields in alias-creation. One for FQDN and one Description.
The vhost is on the same server as everything else.

nslookup on the server returns:

domain.tld {

Non-authoritative answer:
Name: domain.tld
Adress: external-IP
any sub.domain.tld {

Name: sub.domain.tld
Adress: internal-IP

Ok. The configuration seems correct. What do you use on your PC as DNS?

You mean the one that I’m using to access the server?

But the problem isn’t that I can’t reach the server.
the problem is that jp.domain.tld displays the file in /var/www/html. Do you need to configure it extra?

From reading the hints and the docs I got the idea that:
Create vhost using webGUI > this auto-creates a new folder in /var/lib/nethserver/vhost/ > dump your index.html there and you can reach it by vhost.domain.tld.

If you manually have to specify the webroot, what file are you supposed to do this in?

If you want to use default vhost put your file into /var/www/html and you reach it with the FQDN of the server.
If you want to use a VHOST like sub.domain.ext create a Virtual Host with the dedicated page and put your file into /var/lib/nethserver/vhost/name. You should reach these pages by accessing from your browser the domain sub.domain.ext

Wait for your feedback.

ls /var/lib/nethserver/vhost/jp {
[Some php code] }
ls /var/www/html {
[Cheese] }

-> jp.domain.tld

There was also another very strange problem, that when I accessed a site once (except Nethserver on port 980) it would load a page (/Nethserver or jp. [Showing var/www]) but after that would result in a timeout.
(I said “was” because I’ve nuked it. I’m currently reinstalling to see if the problem persists)

Edit: this was formatted to show structure but the forum doesn’t care.
Edit 2: added structure with parentheses

Ok. I’ve reinstalled everything.
Both problems from the last reply are fixed but I don’t know what caused the problem in the end.

When you have the same issue I suggest you making a backup and reinstalling clean.

Thanks for the help! :smile: