I am using Raspberry Pi as multi purpose server. It is been almost two years since since I have started using the Pi. I have started with RPi 3 then upgraded to RPi 4. I am using it as a media server, file server and web server etc. You are reading this blog and this is served by my Raspberry from my home.
I am using a Raspberry Pi 4 with 8 GB RAM and happy on how much it can do and still be fast. My websites are many time faster than when I was using Godaddy shared hosting and it is free and I have complete control over the software I could run.
How everything got started?
Initially I bought a raspberry pi from Amazon for using it as a web server. I have started hosting my website with GoDaddy shared hosting from 2010. It was good for me when I have started but over the time when I had to explore with different technologies there were many limitations on shared hosting so I couldn’t do much. Also the internet was costly and slower in Sri Lanka so I haven’t thought about home based hosting.
Then when I moved to Europe, internet was not an issue so I wanted to give go on home based web hosting. So I ordered my Raspberry Pi from amazon. My initial server setup was different than how I have set it up now. Initially I installed a nginx server and php fpm directly on the Pi started using it. Now I am running many websites and using Docker swarm setup. Also have a backup raspberry Pi running for load balancing. This post is to give introduction on what I can be done from Raspberry Pi. I will write a post on “How to run your website from home?” soon.
Running file server
I was using my SSD disk for running the websites from Raspberry Pi. Earlier I used the same SSD disk as my backup drive by connecting to the laptop while taking the backups. This was not possible now as the SSD disk needs to be connected always to the pi for running the websites. So I thought to setup a file server. This way I can use it not only from laptop also from mobile directly to backup the files.
So first I setup SAMBA file server on my Pi and configured to use the SSD disk. Installed an app on mobile to schedule the backups automatically when I am at home in the night. With my 2TB SSD disk, now I don’t need to worry about running out of space in my google drive. Also the backups were faster as everything happened within my home network. Please read “Setting up home based file server” once I have written and made this link available.
Running Media server
After my media files are added to the SSD disk on the Raspberry Pi, I wanted to play directly from there. That is when I thought of installing a media server (DLNA). So I was searching for some light weight media server and found MiniDLNA. I installed it and checked the performance. Initially it took some process for creating initial index of the media and after that didn’t consume much process. So I stick to using it. This again enabled directly playing my medias and movies from TV and mobile phones. Also I had some songs on my SSD disk which I was able to play using Hi-Fi Cast – Music Player app from my mobile. Read more when the post is ready “Running home media server from Raspberry Pi“
Running network based Ad-blocker
I sometime use ad blockers for protecting my PC and was thinking about using it on my mobile as well. When I heard about the Pi-Hole project wanted to give a try. This is specifically created for running on Raspberry Pi and comes with web based admin interface. This worked well and installed in minutes. This blocks ad in all of the devices using my home wifi. Of course some time you will have to enable ads for example for using ad sense and ad words from google. You disabled the ad blocked for defined time in the Pi Hole admin.
![](https://aboutfullstack.com/wp-content/uploads/2021/01/image-1024x712.png)
Running Docker from Pi
Since I was using my SSD disk for running many websites in parallel and I kept some personal files also in the disk I thought securing them. That is when I started exploring about using docker container in nginx. I tried both Kebernates and Docker swarm. The performance with Docker swarm setup was much faster on the Pi due to low resources available. Even though some features are missing docker swarm was good for accomplishing my goals. There were many limitations while setting up the containers. As Pi uses ARM cpu architecture but many images are not available for this. Even some images supporting arm architecture didn’t run in the Pi. So I have to create images from scratch using my own Docker files. I used alphine based OS as the starting point so my image sizes were much smaller. Alphine linux image size is only 5MB. I will explain this in a detail post later.
The Image creation process takes more CPU once. So I wanted to create the images at my backup Raspberry Pi. So I setup my my own docker registry for making it easy to move images between different environment. I also setup a light weight admin interface with that. I will explain it in another detail write up and add a link here.
Running VPN server from docker
Since I ran my websites from home, when I am not in home it was not possible to upload new changes to the website. So I thought of using a VPN server so that I could still work on my website and will have access to my files in the SSD disk. So I setup PiVPN on the raspberry pi. This enabled same level of access as I work from home.
This is my first post on this blog. I have done this as a introduction post and will do more technical write up on this blog. If you like it please share.
If you are curios what are the websites, this blog is running from my personal web hosting. Some of the production websites are ThePHPCode, DocuSpace, ExamAppDemo.com, PHP Code Store and running many client demo websites.