What I Would Actually Self-Host Again on Linux

Introduction to Self-Hosting

I’ve spent years running my own Linux servers, and over time, I’ve experimented with a bunch of self-hosted services. Recently, I decided to take a step back and simplify my setup. This involved figuring out what actually works for me and what I’d self-host again on Linux.

Choosing the Right Services

It’s easy to get carried away with all the services available for self-hosting. I’ve seen this go wrong when people try to host too many services at once. The real trick is to prioritize what’s truly necessary. For me, that includes a personal wiki, a photo gallery, and a Git server. These services are crucial for my daily workflow and personal projects.

I’ve been using a combination of tools like Nextcloud for file sharing and Gitea for Git version control. Both of these tools have been reliable and easy to set up. Don’t bother with complicated setups if you don’t need them - keep it simple.

Setting Up a Personal Wiki

My personal wiki is built using DokuWiki, which is a simple and lightweight solution. To set it up, I created a new MySQL database and user, then installed DokuWiki using the package manager. Here’s an example of how I installed it on my Debian-based system:

sudo apt update
sudo apt install dokuwiki

I then configured the wiki to use my MySQL database and set up a new admin user. In practice, this was a straightforward process that didn’t require a lot of tweaking.

For my photo gallery, I’ve been using Lychee, which is a self-hosted photo management system. To set it up, I created a new PHP-FPM pool and configured Nginx to serve the application. Here’s an example of my Nginx configuration:

server {
    listen 80;
    server_name photos.example.com;

    root /var/www/lychee;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include fastcgi_params;
    }
}

I then configured Lychee to use my MySQL database and set up a new admin user. This is where people usually get burned - configuring the database and user permissions. Make sure you get it right.

Git Server with Gitea

For my Git server, I’ve been using Gitea, which is a lightweight and easy-to-use solution. To set it up, I created a new system user and group, then installed Gitea using the package manager. Here’s an example of how I installed it on my Debian-based system:

sudo apt update
sudo apt install gitea

I then configured Gitea to use my MySQL database and set up a new admin user. I usually start with the default configuration and tweak it as needed.

Security Considerations

When self-hosting services, security is an essential consideration. I’ve been using a combination of tools like Let’s Encrypt for SSL/TLS certificates and UFW for firewall configuration. I’ve also been keeping my systems up-to-date with the latest security patches and updates. This is not something you want to neglect - keep your systems secure.

Simplifying My Setup

This year, I’ve been focusing on simplifying my self-hosted setup and prioritizing what’s truly necessary. By using a combination of tools like Nextcloud, Gitea, and DokuWiki, I’ve been able to create a reliable and easy-to-use environment for my personal projects. By considering security and using tools like Let’s Encrypt and UFW, I’ve been able to mitigate risks and keep my systems secure.


See also