Page 1 of 1

Access local site by name instead of ip

PostPosted: 02. September 2012 20:07
by Idefix88
Hi,

Installing Lampp 1.8.0 was quite easy and after some fiddling my local site was running.
The linux distro that I use is Ubuntu Server 12.04 LTS.

To access the local site in the network I have to enter the ip adress in my browser like http://123.456.7.8, but (and I know it is possible) I want to achieve that everyone in the network kan type http://site.
I have looked in several files, but I cannot find this option. I think it is quite easy to solve, if you know where to look for.

Does anyone know where to look for?

Thanks in advance.

Re: Access local site by name instead of ip

PostPosted: 03. September 2012 17:07
by JonB
If you don't have a registered domain, and the site is truly local you can use entries in the 'hosts' files on the client machines.

where xxx.yyy.zz.nn is the IPv4 dotted quad

Code: Select all
xxx.yyy.zz.nn   sitename   


http://en.wikipedia.org/wiki/Hosts_(file)

Once it is working, you can change the settings in httpd.conf and any scripts you are running.

Good Luck
8)



yaasf

Re: Access local site by name instead of ip

PostPosted: 03. September 2012 19:49
by Idefix88
Thx for your answer, but I do not get the second part of your answer.

I want to achieve the following

The following components are in my network (so I don't have a registered domain)
PC 1
PC 2
Server

I have changed the host file on the server and when I'm starting up the browser on the server I can see the site via http://site
My intention is to get this also working on PC 1 and PC 2, so I can visit the site by typing http://site on these computers. Since I'm a little new to this can you be more specific what I have to change in the httpd.conf, so I can achieve this?

Re: Access local site by name instead of ip

PostPosted: 04. September 2012 13:31
by JonB
if the site is truly local you can use entries in the 'hosts' files on the client machines.


each PC would have an entry in its hosts file like this:

Code: Select all
xxx.yyy.zz.nn   server


where xxx.yyy.zz.nn is the local IP of the server you have installed XAMPP/lampp on

then you can type

http://server

and you should get the Index page of the DocumentRoot.

BTW I usually add .local to the end of the URL's i.e. server.local, it makes it a bit clearer what is happening.


Good Luck
:)

Re: Access local site by name instead of ip

PostPosted: 05. September 2012 19:38
by Idefix88
Hmm it is not my intention to change the hosts file on every individual machine. I know that it is possible to configure the server in such a way that this is not necessary. My synology for example can be accessed by local ip or http://diskstation.

Re: Access local site by name instead of ip

PostPosted: 05. September 2012 21:00
by JonB
Well when you figure it out, let me know.

As -- absent a hosts file entry, DNS, or installing software on them -- there is no way AFAIK to 'tell' those workstations how to find your server (of any kind, not just XAMPP). If you are using your synology NAS as a DHCP server - that is the mechanism that is supplying that address. Its actually an injection (just like a hosts file). Many routers have an identical mechanism to help with auto-configuration.

Good Luck