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.

Leave a Reply

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