Access local site by name instead of ip

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Access local site by name instead of ip

Postby Idefix88 » 02. September 2012 20:07

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.
Idefix88
 
Posts: 3
Joined: 02. September 2012 19:47
Operating System: Ubuntu server and Windows

Re: Access local site by name instead of ip

Postby JonB » 03. September 2012 17:07

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
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Access local site by name instead of ip

Postby Idefix88 » 03. September 2012 19:49

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?
Idefix88
 
Posts: 3
Joined: 02. September 2012 19:47
Operating System: Ubuntu server and Windows

Re: Access local site by name instead of ip

Postby JonB » 04. September 2012 13:31

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
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Access local site by name instead of ip

Postby Idefix88 » 05. September 2012 19:38

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.
Idefix88
 
Posts: 3
Joined: 02. September 2012 19:47
Operating System: Ubuntu server and Windows

Re: Access local site by name instead of ip

Postby JonB » 05. September 2012 21:00

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
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 48 guests