How to run a server on your laptop and make it accessible over your Wi-Fi

Rahul Kumar
2 min readSep 28, 2024

To run a server on your laptop and make it accessible over your Wi-Fi network, you can follow these general steps. I’ll use a simple Python HTTP server as an example, but the concept applies to other types of servers as well.

Step 1: Run the Server

Using Python

  1. Open a terminal/command prompt.
  2. Navigate to the directory where you want to serve files. You can use the cd command to change directories.
  3. Run the following command to start a simple HTTP server:
python3 -m http.server 8000

This will start a server on port 8000.

Step 2: Find Your Local IP Address

  1. Open a terminal/command prompt.
  2. Run the following command to find your local IP address:

On macOS or Linux:

ifconfig

Look for an IP address under the en0 or wlan0 interface (usually starts with 192.168.x.x or 10.x.x.x).

On Windows:

ipconfig

Look for the IPv4 address under your Wi-Fi connection.

Step 3: Access the Server from Another Device

  1. Ensure both devices (your laptop and the device you want to access from) are connected to the same Wi-Fi network.
  2. Open a web browser on another device (like your phone or another laptop).
  3. Enter the URL in the address bar:
http://<your_local_ip>:8000

Replace <your_local_ip> with the IP address you found earlier (e.g., http://192.168.1.10:8000).

Step 4: Allow Firewall Access (if necessary)

If you can’t access the server, it might be due to firewall settings:

On macOS:

  1. Go to System Preferences > Security & Privacy > Firewall.
  2. Click on Firewall Options.
  3. Ensure that Python (or the specific application you are using) is allowed to accept incoming connections.

On Windows:

  1. Go to Control Panel > System and Security > Windows Defender Firewall.
  2. Click on Allow an app or feature through Windows Defender Firewall.
  3. Ensure that the Python executable is allowed through the firewall.

Additional Notes

  • If you are running a different type of server (like a web server using Flask, Django, Node.js, etc.), the steps to run the server will vary, but the local IP address and access method will remain the same.
  • Ensure that the server you are running binds to all interfaces, usually by using 0.0.0.0 in your server configuration. For example, in Flask, you can run your app with:
app.run(host='0.0.0.0', port=8000)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Rahul Kumar
Rahul Kumar

Written by Rahul Kumar

Yup! I code this is my superpower.

No responses yet

Write a response