It’s really frustrating to host a server from your home network. Requiring you to set up hundreds of things. Worry not, In this tutorial, I am going show you the easiest way you can host a server directly from a Windows machine.
Using ngrok and python http.server it’s really easy to host a server on your computer and you don’t actually have to forward any port or do anything else. All you need is ngrok and python installed on your computer and in just a snap 🫰you can host a server.
Prerequisites
Before hosting a server you will need these 3 things installed on your computer
You only need to install these things before hosting a server. At least for the sake of this tutorial 😁. In this tutorial, I will only show you how to install the ngrok using choco. You can also download the ngrok zip directly from here.
Steps to create a server
1) Install ngrok using the command choco install ngrok
(for windows with chocolaty)
2) In the terminal open the location of the folder you want to host over the internet
3) In terminal type python -m http.server 8080
4) Now, in another terminal use command ngrok http 8080
You have to specify the same port on both services because the server hosted using http.server on localhost port 8080 is hosted over the internet by ngrok.
You are telling ngrok that you need to transfer this server to the internet which is hosted on localhost at port 8080.
If you followed the steps correctly you should see something like this :
You should see a message like this:
ngrok by @inconshreveable
Session Status online
Account Your Account (Plan: Free)
Version 2.3.40
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://12345678.ngrok.io -> http://localhost:8080
Forwarding https://12345678.ngrok.io -> http://localhost:8080
Now you can access your files from the https URL that ngrok gave you. Anyone who has the URL can also access your files. To stop hosting your server, press Ctrl+C in both command prompts and close them.
Caution
It’s really easy to host a server like this but insecurity comes with it as well. This is because password or 2FA is not present in any form when using http.server
. So this is good for a short period but if you want to keep the server running 24×7 you should use dedicated software for hosting a file server. You can use FileZilla, FreeNAS or the Built-in FTP server that comes with Windows for hosting a file server.
Advantages of using ngrok
You can indeed just forward a port of your home network and stay away from the headache of installing Choco, python and ngrok. But using ngrok I don’t have to forward port, increasing my network security and also I can easily forward any service running on any port on my localhost.
So, if you ever want to play Minecraft or any other game with friends who are not on the same network, you can use Ngrok to forward the server hosted on your computer in just a snap 🫰. No need to worry about leaving a port open for an attacker.
I have also seen that some ISPs don’t allow their users to forward port on their modem and some do it for with certain restrictions, In this case, it’s just necessary to use a service like ngrok 😂.
Wanna Know how your computer boots up, Read the article below 👇