0

I am trying to access on my LAMP server website a name-based virtual host—named homeapp—from other computers and a tablet.

  • My LAMP server Ubuntu IP is 192.168.2.10.

  • My Laravel website is virtual hosted by named, homeapp.

  • I can access to my IP 192.168.2.10 but problem is it just opened localhost index page.

  • How can I access to my virtual hosted websites from same network?

  • Do you mean you want other computers on the same network to access the Apache name based virtual host homeapp? The phrase “localnet” is a bit confusing. – JakeGould Apr 2 '15 at 2:59
  • Hi Jake, yes. I just edited. Could you suggest me how to setup? I googling and got some said, dns_server needed, some suggest to use pfsense. I am just reading about pfsense. Could you give me some useful link to learn. Thank advanced. – Ryan Exlay Apr 2 '15 at 3:06
  • Ryan, pfsense is overkill the recommendation in krowe’s answer is the best practical advice. But that won’t help with the tablet unless you can edit the /etc/hosts file on the tablet. Perhaps the better solution is to just host your site on the main localhost setup of your LAMP server. – JakeGould Apr 2 '15 at 3:21
  • 1
    Hi Jake, Laravel angular app is a bit complicated to setup under localhost rather than virtualhost. I don't want to change route system of my app and laravel encourage to use virtualhost. :-( And I think virtualhost is a better practice than locahost. – Ryan Exlay Apr 2 '15 at 3:40
1

You simply need to add an entry to your host file. Then you'll be able to use a DNS name to access it. The following command will do what you want:

echo "192.168.2.10 homeapp" >> /etc/hosts

You'll need to do this on each client that you'll be accessing this site from. For Windows clients it will be very similar:

ECHO "192.168.2.10 homeapp" >> %System32%\Drivers\etc\hosts 

Tablets

Yes, your tablets and smart phones will also (generally) have a host file but you'll need a rooted device in order to edit it. Once that's done, all of the common Tablet OSes have several terminal apps available. Another option would be to use the Android Debug Bridge to edit it. Just copy the host file to the device and use the following command (assuming that the device is at F: and you've put your host file there):

adb push F:\hosts /system/etc/

This will put the host file on the device shared drive over the stock file.

A better tutorial is on howtogeek.com

NOTE: If you have an internal DNS server then you can (and should) just add an 'A' record for it instead.

  • 2
    Thank krowe, it is a good solution. It solve my problem. But as said, I can't change un-rooted tablet hosts file. Anyway It can be accessed from another computer. I will try to setup internet DNS server on my Ubuntu. Anyway thank. – Ryan Exlay Apr 2 '15 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.