Web-Hosting on Raspberry Pi

Feb 2025 - now

Project Idea

Hosting a website requires a domain name and a server where the website is running on. I wanted to host my own website to learn more about web hosting and server management in general. Additionally, it is a great way to present myself and share some information about me with others.
A domain can be acquired quite cheaply. But hosting a webpage on a server is more expensive. A Raspberry Pi is a cheap mini computer that is light on power consumption making it the perfect choice for a web server. Starting with this, it opens up a lot of possibilities to host other services or to extend it to my own cloud server.

Description

Requirements

  • Domain
  • Raspberry Pi (min. 2 GB RAM)
  • SD Card (min. 8 GB)
  • Power Adapter for Raspberry Pi

These things can be bought online. I got it from the raspberry pi online shop.

How To

The following webpages helped me with this project:

Documentation

Raspberry Pi Webhost

Domain

I bought my domain from a domain provider. In normally they do not cost much. The next things we need are a web server that will host our website and respond to requests from any possible client. As pointed out, the Raspberry Pi is a great choice for this purpose. The other thing we also need, is a webpage with content we want to host.

Step 1: Creation of a web page

There are many ways to create a webpage. The more user-friendly way is to use a CMS like WordPress or Joomla. My website is based on the python's Flask framework. Therefore, I followed Miguel Grinberg's Flask Mega-Tutorial. Jinja2 templating is used together with the CSS framework Bootstrap5 powered by Flask's backend framework.

Step 2: Setting up Raspberry Pi for Hosting

I used the Raspberry Pi OS x64 version for my Raspberry Pi 4 Model B. The Raspberry Pi OS is a Debian-based operating system, which I prefer as a ubuntu user.
My webpage is embedded inside a docker container. Docker is a great way to manage and deploy applications across multiple operating systems. Moreover, it allows for scalability of many services on only one Raspberry Pi.

Personal Takeaway

I always dreamed about having my own webpage. Finally, I had the time to make it happen. It was very interesting to learn more details about web hosting and setting up and configuring a server. This is only the beginning for further customization and extension of my server with more services e.g. a cloud or a self-hosted note-taking tool.