posted on Tue, Jun 23 '20 under tag: tech

Running a server and accessing it from a different computer on a different network is one of the happiest things in learning to be a web developer. Here is how to go about it

A “server” is a fancy word for a computer that is always on and always connected to the internet with an IP address that’s universally resolvable to itself.

A server can run a webserver software within it which can listen to and respond to web requests.

Imagine typing in “asd.learnlearn.in” on your browser. Somewhere in the world I am running a computer with a software that responds with data required to render my website in your browser. When you type the address “asd.learnlearn.in” it gets resolved into a series of numbers like 18.188.31.177 called an IP address. This, for computers, is like a complete postal address to your home is for a home delivery person. Your computer on behalf of your browser will then make a connection to my computer which will be handled by the webserver software I am running at the other end. The webserver software will respond with the content that should get displayed for the home page of my website.

Read also: 3 important things about the internet that millions do not know

Now, let us go look at the definition of a server again. A server needs to be:

Setting up one’s own server

When you want to run a server of your own, you have two options.

If you have a computer of your own and good internet connection you could think about setting up a home server. The alternative is, you could request someone in the business of running servers - like amazon, digitalocean, scaleway, etc to run a server for you. There are pros and cons of both.

Home server

Setting up a home server is an incredible learning opportunity. The very first time you see a “hello world” that’s coming from your own computer over the internet is an unforgettable moment.

It will require you to figure out multiple things.

  1. Your internet service provider may not have assigned a universally accessible IP address for your connection. You may have to talk to them and get a public (and optionally static) IP address. Sometimes you would have to pay extra for this.
  2. You will most definitely have to configure your router to forward the requests to your computer (unless you have directly connected the internet connection to your computer through ethernet or something).
  3. You will have to run a server software on your computer and configure it correctly too.

Read: Setting up Home Server

Cloud server

This may cost you some money. Although, most cloud server providers do give a free preview for one month (and some upto an year even).

Essentially, someone else will run a server in their “house” (or data center). You will be able to interact with “your” server through special programs like ssh. And you will have to configure it with the webserver software to respond to visitors.

There are several advantages to a cloud server:

Of course there are disadvantages:

Conclusion

Either way, setting up a server gives you complete understanding of the web stack.

Afterwards, you may want to buy a domain and build yourself a home on one corner of the internet.

Feel free to reach out to me if you are stuck somewhere on this path.

Like what you are reading? Subscribe (by RSS, email, mastodon, or telegram)!