How to access localhost from another computer connected to the same network?

Sometimes there occurs a situation. where you have to show your website which is hosted on your computer to your boss or to any of your colleague who is not sitting beside you. But he is connected to the same network that your computer is connected to.

In this case, you can show your website to your boss or colleague. All you have to do is just allow traffic for the port that your web server is listening on.

Note: If you want to access your localhost on a computer that is not connected to the same LAN. Then you should read this article.

Here are the steps to make localhost accessible from any computer on the same local network.

Make localhost accessible from another computer on Windows.

  1. Go to Windows Firewall settings and click on advanced settings.

Advanced Settings in Windows Firewall

2. In the Inbound rules, click on “New Rule” option and a wizard window will pop up.

New Inbound Rule option in windows firewall settings

3. In the wizard there are five steps. In the first step you have to select type of rule. Since we are to allow traffic for a specific port. Therefore select the port option.

First Step of new Inbound Rule wizard

4. Now choose “Specific local ports” option and enter port number that your web server is listening on.

If you don’t know on which port your web server is listening on then it is the number that you specify after ” : ” symbol in URL bar of your web browser while opening localhost on your computer. Eg: If you type “localhost:8000” or “127.0.0.1:8000” to access localhost on your computer then your web server is listening on port number “8000”. But If you don’t specify any number, that is you only type “localhost” or “127.0.0.1” then your browser implicitly enters default port. which is port number “80”. That means your web server is listening on port number “80”.

Second step of new Inbound Rule wizard

5. Now you have to choose an action. choose “Allow the connection”.

Third step of new Inbound Rule wizard

6. Now specify when does this rule should apply. choose all of the options.

Fourth step of new Inbound Rule wizard

7. Now give a name for this rule. You can also specify a description for this rule which is not mandatory.

Fifth step of new Inbound Rule wizard

8. Finally click on the finish button to save the new rule.

now just go ahead and type local IP address of your computer in web browser of other computer which is connected to same local network. To find local IP address of your use ipconfig command.

If It doesn’t work then you have to configure your web server to listen on local IP address or all available IP addresses for your computer.

Make localhost accessible from another computer on Ubuntu.

In Ubuntu, the requests for port 80 are already allowed. Therefore you don’t have to mess up with firewall settings. Just type your Local IP address in a web browser on another computer.

To find local IP address of your computer type ifconfig in terminal.

14 comments on “How to access localhost from another computer connected to the same network?

    1. Amarjit Singh Post author

      1. Mobile phones can also access the localhost if it is connected to the same network as that of the computer.
      2. It doesn’t require internet connection

      Reply
  1. David

    I followed your guide, it worked to the point of being able to access my WAMPserver www content, so long as the content was just static html pages. But I cannot get my wordpress site to show up on remote networked machines. Firewall shut down, root directory and not vhost, with wampserver set to “online” mode. Have you got any ideas what my problem might be, please?

    Reply
    1. Amarjit Singh Post author

      Hi
      yeah, I understood your problem. But not the last part of it “firewall shutdown, root directory and not vhost etc”. From the part I understood is that your www content is running on a different port than the port on which WordPress is running.

      Reply
  2. Spiritlight

    Hi,
    My localhost is running the 81 port number (localhost:81). I tried to type my local IP address (10.5.20.19) in web browser of other computer which is connected to same local network. Unfortunately, it redirects to 10.5.20.19/dashboard/ which is a website of XAMPP. I’d like to know whats wrong ?

    Reply
    1. Amarjit Singh Post author

      Hi
      If you access your website on your computer by using localhost:81 then you will need to put “:81” after your computer IP on the other computer. If you just put an IP on another computer then it will use port 80 by default but on port 80 your XAMP dashboard is running. Also in the windows firewall rule, you need to put port 81.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *