beanz Magazine

Servers

Torkild Retvedt on Flickr

Check out this quick guide on how to make your very own server!

The term “server” gets thrown around a lot and I think a lot of people have some kind of intuitive sense of what it might mean—it’s something your computer or phone talks to to do things online—but it’s not always clear what exactly servers are and I think it’s even less clear that these are things you can make yourself and run on a computer at home! So we’re going to explain what servers are, give a simple example of starting a server on your computer and how to interact with it, and then share some kinds of servers you might want to run at home!

To start things off, a server is just a program that listens for requests from other programs called clients—whether those programs live on the same computer or across the internet half a world away—and gives back responses. The act of giving back a response is called serving the response, like the way you talk about serving a meal, hence why the program doing the listening and responding is called a server.

These days when people say “server” they usually mean “web server”, since that’s the kind of server we interact with the most. Your web browser is the client and the web server takes requests for web pages and then gives back all the HTML, CSS, and JavaScript code needed for the browser to render the page.

But there are all sorts of kinds of server: the are servers that let you move files between computers, servers that let you remotely play movies on a TV, music servers that trigger samples and send the audio signal to speakers so you can play music remotely, and game servers that synchronize the game between all the players and send back all the information needed to render the next frame of the game.

So I promised an example of starting a server on your own computer and for this example you’ll need to have Python installed and access to the command line for running Python programs. It’d also be best to do this at home or someplace where you know the people around you. Start by making a new directory, I’m going to call mine python-server, and while inside this directory you’ll just need to type

python3 -m http.server

And you should get a message telling you that it’s serving at either 127.0.0.1 or 0.0.0.0 at port 8000. Now, on the same computer, open your web browser and type 127.0.0.1:8000 in the URL bar and hit enter. You’ll see a rather uninteresting screen because it’s just listing all the files in the directory you ran the command. Try moving something into this directory and refresh the page to see the new file.

For the next part, you’ll need two things: first you need to know the IP address of your computer on the local network. Then, you’ll also need access to another computer or even your phone that’s on the same wifi network.

To find the IP address, go back to the command line and if you’re on a windows machine type ifconfig and if you’re on a mac or linux machine type /sbin/ifconfig or ip a one of those two will work. You’ll see something that looks like the following:

You want the IP address listed after inet. In my case it was 100.115.92.197. This is the IP internal to the network you’re on, and is different than the IP address other computers see outside of being connected to the same wifi. On your phone or another device connected to the network type this IP address followed by 8000 instead, so in my case 100.115.92.197:8000. You should see the same file you moved earlier.

This may be a simple example, but you’ve started a server that runs on your network!

You now know enough to start setting up other servers on a home network. For example, have you ever wanted to try having your own private wiki? That’s easy enough by downloading the wiki server Gollum (https://github.com/gollum/gollum) and following the instructions. But you can also do so many things. For my own purposes at home, I have a little server running on a raspberry pi that presents a webpage where you can do things like paste in a youtube URL and play the video on our TV, or there’s a button that you can press that plays a dog going “arf” over a pair of speakers. That one is fun to use when no one is expecting it.

But the point is that there’s so many things you can do once you start learning server programming!

Learn More

Servers explained

https://www.paessler.com/it-explained/server

What is a server?

https://www.serverwatch.com/guides/what-is-a-server/

Types of web server

https://www.hostitsmart.com/blog/types-of-web-server/

Server facts for kids

https://kids.kiddle.co/Server

What is a web server?

https://www.youtube.com/watch?v=Yt1nesKi5Ec

Apache HTTP Server

https://academickids.com/encyclopedia/index.php/Apache_HTTP_server

Setting up a business server

https://blog.avast.com/setup-server-business-avast

How to setup a Minecraft server

https://help.minecraft.net/hc/en-us/articles/360058525452-How-to-Setup-a-Minecraft-Java-Edition-Server

Five reasons to make your own server

https://www.makeuseof.com/tag/5-reasons-server/

Set up your own web server

https://www.instructables.com/Set-up-your-very-own-Web-server/

How to make a Minecraft server

https://codakid.com/how-to-make-a-minecraft-server/

Creating a Minecraft server

https://www.idtech.com/blog/creating-minecraft-server

Home servers

https://lazyadmin.nl/home-network/home-server/

Also In The April 2022 Issue

Bring your Minecraft game to new heights with the Aether mod.