Page 1 of 1

how to block the access to the server all over the IP

PostPosted: 24. November 2010 00:39
by pafeu
I welcome
how to block the access to the server all over the address ip
I want the access to my server to be but through the domain address
I am novice please for accurate writing what where to put so that acts
I apologise for my tongue but I am not good at English and I translated this text with translator :wink:
help me

Re: how to block the access to the server all over the IP

PostPosted: 24. November 2010 06:20
by Altrea
sorry, i don't understand what you want to have.
Please can you try to explain this?

Re: how to block the access to the server all over the IP

PostPosted: 24. November 2010 11:53
by Nobbie
Er möchte, dass sein Server nur via Domainnamen erreichbar ist, nicht aber durch Eingabe der Server-IP. Das geht natürlich so nicht, "erreichbar" ist der Server immer, aber man kann natürlich VirtualHosts so einrichten, dass der Default-Fall (erster Host) eine Fehlermeldung ausgibt.

Das darfst Du ihm jetzt auf englisch erklären und zwar so, dass er es auch versteht... ;)

P.S.: Elegant wäre auch einfach einen Redirect auf den Domainnamen zu machen. Sicher auch eine gute Lösung.

Re: how to block the access to the server all over the IP

PostPosted: 24. November 2010 17:58
by JonB
I think I know what you are asking -

You want to make it so the only time a user gets the website is when they type in a Domain Name

You will have to set up at least two Named Virtual Hosts.

The First virtual host can be empty basically - just an index.html if you want - when someone types the IP address of your XAMPP server or its router - they will get the 'empty web site' (with just a placeholder page) - it SHOULD have at least one page to prevent 404 errors.

the name for this first Virtual Host can be anything - but probably localhost is best.

The second virtual host will be the 'real site' - and its name will the the hostname+domainname

i.e - http://www.mydomain.com

And that is where you will put your files, documents and scripts.

How to do this:

http://httpd.apache.org/docs/2.0/vhosts/name-based.html

Also look at this:
XAMPP has an example to follow in \xampp\apache\conf\extra\httpd-vhosts.conf


Good Luck

8)

Re: how to block the access to the server all over the IP

PostPosted: 26. November 2010 23:04
by pafeu
I want in order to access only http://pracaforyou.pl
how to block the access http://84.10.149.37/www/pracaforyou/forum/index.php
they didn't help vhost
how to do it
please for the help

Re: how to block the access to the server all over the IP

PostPosted: 26. November 2010 23:56
by JonB
Actually - a vhost will work -

You simply must not put the additional vhost's DocumentRoot under the default DocumentRoot of the installation. That is known as nesting, and each site will ALSO be part of the site that is its 'parent'. That is an awful practice security wise.

lets say XAMPP DocumentRoot is on C:\xammp\htdocs

Then anything that is BELOW c:\xampp\htdocs in the folder structure can also be accessed by the IP address. (that will include the FIRST vhost)

for the next (the important one) Vhost you make the DocumentRoot c:\sites\mypolskisite

NOW there is no way to add anything to the IP's root to get to the virtualhost. BTW, its the same on all websevers, not just Apache - it works on IIS, although they use a different term - 'virtual server'. As long as you make the access method 'Host header name', and DO NOT NEST your virtual hosts - the only way to access the vhost or virtual server is through an HTTP request that contains the 'server name'.

Good Luck
8)

Re: how to block the access to the server all over the IP

PostPosted: 27. November 2010 07:35
by bradzo
Great answer Jon

That's what I found also on IIS - the "Host header name"

And that's the key - the only way to access the site is through the "server name"