How do I access a local web server on my laptop from another computer? [closed]

First you need to determine the ip address or name of the machine you are running the webserver on. I’m assuming you are running the webserver on a mac since you tagged your post macosx athough the instructions are similar for linux machines. So, on your mac:

  • Open Terminal.app. It’s under Applications->Utilities.
  • Run ifconfig in the terminal. That shows you all the network interfaces on the machine. One of them is the network your machine is actively connected to. If you mac is on a wired connection that should be en0. Make a note of the address after inet – that should be the address your machine uses.
    • Let’s assume you discover it’s 192.168.10.1.
  • Verify that you can connect to that address from your server with nc -v 192.168.10.1 3000. (replace 3000 with the port your application is running on)
    • You should see a message like Connection to 192.168.10.1 3000 port [tcp/http] succeeded!.
    • If that doesn’t work, see below.
    • If it does work, hit ctrl-C to exit the nc session.
  • Now try to connect on your client machine.
    • If this is a web app, you should be able to connect via the browser
    • For example, try http://192.168.10.1:3000

If you are unable to connect to your application on the server’s real address, that means your application isn’t listening on that address. You will need to investigate how to change your application configuration to modify that behavior. Since I don’t know what application you are running I can’t offer any good ideas on that.

Leave a Comment