Yet Another New Home Server
This year has seen me doing more in the way of little tech projects at home than I have done for a while, perhaps due to covid lock downs so if that's the case then I'll take this small positive from an otherwise rubbish situation. Typically for me, these projects have focused around open source projects and some IoT. More on those in some separate blog posts when I get around to writing them up. But for now, I wanted to make some notes on my new home server set up.
I've had an array of different low powered home servers of the years that I've previously written about, namely the NSLU2, TinyTuxBox, Joggler and for the past many years a simple ReadyNAS box that I specifically bought for the Intel processor as it made compiling different bits and pieces a whole lot easier back in the day. However, I have recently relegated the ReadyNAS box from home serving duties, keeping it only for its native NAS services because using it for other things has become increasingly difficult without updating the entire base OS (which is possible by I'm reluctant to do) due to down level software libraries like an ancient version of openssl.
In with the new then and I moved away from Intel architecture as it's now so much easier to compile for Arm chips and went with the, wait for it, drum roll, rather obvious choice of a Raspberry Pi 4. Specifically, a Pi 4 Model B, 4GB. I've paired it with the official Pi case power supply, micro HDMI cable and shoved in an A2 SanDisk Extreme 64GB SDXC card.
And so to the notes, my initial target for this new box would be as follows:
- The Lounge self hosted web based IRC interface
- A Mosquitto MQTT broker
- Node Red for home automation event processing
- An NGINX reverse proxy
- letsencrypt certificates for all of the above
The Lounge
- host: "127.0.0.1"
- reverseProxy: true
- theme: "morning"
- pid_file (probably just because I'm old fashioned like that)
- user (to drop privileges)
- listener (to specify a port number)
- certfile and keyfile (for SSL)
- log_dest (create a specific log file for the broker)
- clientid_prefixes (a bit of added security to only allow certain client IDs to connect to the broker)
- allow_anonymous (quite an important one!)
- password_file (so that connections are authenticated)
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /path/to/your/server.crt;
ssl_certificate_key /path/to/your/server.key;
server_name your.server.name.com;
root /var/www/html;
index index.html index.htm;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ^~ /YOUR_PREFERRED_IRC_URL_GOES_HERE/ {
proxy_pass http://127.0.0.1:9000/;
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# by default nginx times out connections in one minute
proxy_read_timeout 1d;
}
# Configure reverse proxy for Node Red
proxy_pass http://127.0.0.1:1880/;
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# by default nginx times out connections in one minute
proxy_read_timeout 1d;
}
}