Vhost only from trusted network, does not show forbidden

Hi everyone,
I bet this is an easy one… but I was unable to find this already solved on the community…

I’ve got a vhost reachable only from trusted networks, and it works like a charme.
But… if outside the trust is showed the default nethserver landing page… and I really would like to explicit forbidden content.

How to do so?

Thanks for reading

Hi @trogloraspa

I’d suggest changing your default “landing page” like I do:

try using:

https://intranet.r7.anwi.ch/

or using the servers fqdn:

https://awr7-nethserver.r7.anwi.ch

This second one is a simple html page in /var/lib/ww/html/

NethServer has basically two folders for webhosts:
The “default”, used for any, non specified access, like using IP instead of name.
This is /var/ww/html/. If any index.html is in this folder, it is shown instead of the default landing page you are seeing. This is also shown if using the IP to access my server. Try it!

And then there specified hosts, like when you setup anything with a vhost, these are here:
/var/lib/nethserver/vhost/VHOST-NAME/

My 2 cents
Andy

Hi Andy,

I’ve already changed the default page on /var/www/html with a custom one.
but still land to nethserver default if vhost is reached from a not trusted network.

thanks

1 Like

I sppose you can use a custom template to change that segment of code in apaches config.
But I have no idea myself and would need to read the httpd.conf first to find out where it needs to be changed…

Best would be to look in /etc/e-smith/templates/etc/httpd/…

My 2 cents
Andy

Hello @trogloraspa !
What I did was follow these steps:

https://docs.nethserver.org/projects/nethserver-devel/en/latest/nethserver-httpd.html#welcome-page

And once the index.html file is created, I leave it blank so that if you go to any vhost (which is only accessible from the internal network) or directly from the IP, you will see a blank page.
You can also make a script so that after X seconds you are redirected to the page you want. To do this, simply add this to an index.html:

<html>
<head>
<meta http-equiv="Refresh" content="5;url=http://example.com" />
</head>
</html>

In content is where we tell it that after 5 seconds, it will take us to that other page.

I hope it helps you

Hi Jon, thanks for reply…
unfortunately I was abducted to other problems to fix and now this issue has a lower priority… I will provide proper feedback as soon as I go back to the problem.

:slight_smile: