TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How I built this website on a Raspberry Pi

115 pointsby mirawelner4 months ago

25 comments

rednafi4 months ago
I like how the author didn’t try to be overly clever with it. They could’ve used Docker to install and isolate dependencies, Caddy or Traefik to serve the site and manage SSL automatically, maybe even k3s to run a mini cluster for HA, Tailscale to avoid manual port forwarding, Terraform for future auto-provisioning without hassle, or Ansible to prepare the machine and all that jazz.<p>Instead, they took the simplest possible route that works: installing the web server on bare metal, serving plain HTML and CSS, and using direct port forwarding via the router. This was a delightful read.
评论 #42756730 未加载
评论 #42756406 未加载
评论 #42756394 未加载
评论 #42755950 未加载
KronisLV4 months ago
&gt; Step 5: Getting an HTTPS Certificate<p>If you’re using Apache2 you might also want to look at mod_md, not just certbot: <a href="https:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.4&#x2F;mod&#x2F;mod_md.html" rel="nofollow">https:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.4&#x2F;mod&#x2F;mod_md.html</a><p>Also, if you want to minimize the amount of JS, then just drop jQuery and use fetch, it’s reasonably pleasant too: <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Fetch_API" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;Fetch_API</a><p>Lovely article!
评论 #42764579 未加载
LarryMade24 months ago
I had set one (Pi 3B+)up to do both a website as well as a public service announcement slideshow display for a local Community TV. Used PHP&#x2F;CMSimple for the site and wrote a custom slider.<p>Things I learned:<p>- set the pi to reboot on poweroff<p>- Given this was TV used the AV output on the PI displaying in NTSC 4:3 (to support customers with older TVs), so had to be aware of overscan margins<p>- Added a startup script to start chromium in kiosk mode and open the slider page for the show side. worked 95% of the time, if not just power off then on.<p>- part of the troubleshooting was just unplug and replug - but SD cards will choke on too many power cycles, so instead of SD use a USB-&gt;SATA cable and a regular spinning rust HDD - slower but VERY reliable, the journaling file system can recover after power-outage.<p>- Get the right USB-&gt;SATA cable, USB-3 models seem to be more responsive and the PI can boot from them, there are some are too slow and the Pi will fail to boot.<p>- Slider had it&#x27;s own login page (outside of CMSimple) to remotely manage the slideshow.<p>- Also changed the SSH Port to something uncommon to thwart bad guys.
hcheung4 months ago
I did something similar in 2016 <a href="https:&#x2F;&#x2F;www.e-tinkers.com&#x2F;2016&#x2F;11&#x2F;hosting-wordpress-on-raspberry-pi-a-complete-approach&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.e-tinkers.com&#x2F;2016&#x2F;11&#x2F;hosting-wordpress-on-raspb...</a>. Instead of having Apache, I use Nginx. Instead of serving webpage from SD card, I setup a 512MB hard disk except booting still done via the SD card. The site is still running on a Raspberry Pi 3 till this day from my living room.
评论 #42760529 未加载
bryancoxwell4 months ago
Very cool, very accessibly written. Thanks for sharing.<p>Curious how you handle your router’s public IP changing as (I believe?) this is pretty common depending on the ISP, no?
评论 #42761948 未加载
InMice4 months ago
Surpised he does not have a step for a assigning a permanent address for the local network. He mentions it but skips it like it&#x27;s not needed. a lot of routers like those from att do not allow port forwarding to addresses that have finite lease times.
评论 #42763798 未加载
Oanid4 months ago
Great article—thanks for sharing! I did something similar nine years ago with a Raspberry Pi 3 Model B. It stayed online for nearly a decade until it went offline at the end of 2024, following Google&#x27;s decision to sunset my OnHub router.<p>Initially, I used it as a CUPS server to turn a non-networked Brother printer (HL-2240) into a wireless printer after Google discontinued Google Cloud Print.<p>The printing project was a lot of fun and inspired me to dive into another challenge: self-hosting. Along the way, I learned a great deal about Apache, SSL certificates, security, and just how fragile SD cards can be!<p>The print server still works well, though I’ve since downsized to a Raspberry Pi Zero W.
rainonmoon4 months ago
This is a wonderful project and an even more wonderful write-up, I wish I came across more in this tone! I&#x27;ll just add to anyone following in these footsteps: be careful what <i>type</i> of website you host on your Pi. Self-hosting is great, but if you expose services on your home network to the internet, expect people to try to hack you. What type of site you host will either make this very hard or very easy. The difference between compromising a VPS and compromising your home web server is now they have access to your actual LAN. Cloudflare has a pretty good WAF on the free tier, look at it as another learning opportunity.
评论 #42761111 未加载
评论 #42755615 未加载
评论 #42754926 未加载
评论 #42754611 未加载
jpc04 months ago
Regarding private keys and computers going in for repairs...<p>I know it&#x27;s not strictly best practice but store your private key in your password manager. That way if the worst happens you aren&#x27;t up a creek...
评论 #42758778 未加载
评论 #42756005 未加载
tzury4 months ago
To the OP:<p>Make sure you have updated firmware to latest, plus added active protection against the following known vulnerabilities.<p><a href="https:&#x2F;&#x2F;nvd.nist.gov&#x2F;vuln&#x2F;search&#x2F;results?form_type=Basic&amp;results_type=overview&amp;query=R6020&amp;search_type=all&amp;isCpeNameSearch=false" rel="nofollow">https:&#x2F;&#x2F;nvd.nist.gov&#x2F;vuln&#x2F;search&#x2F;results?form_type=Basic&amp;res...</a>
评论 #42761020 未加载
VBprogrammer4 months ago
I really enjoyed this but at the same time find it completely perplexing - I can&#x27;t place where the author is coming from - they are either really good at explaining things from the point of view of someone who knows almost nothing about this stuff or they genuinely started this without knowing most of it. I&#x27;m not sure which would be more impressive.
评论 #42760965 未加载
评论 #42755505 未加载
评论 #42755913 未加载
hsshhshshjk4 months ago
Thank you, this is a wonderful step by step. Saved for the next time I get a chance to sit down and fiddle. Cheers!
评论 #42754978 未加载
评论 #42760970 未加载
ewalk1534 months ago
I use Kamal[1] to host all my side projects on a Raspberry Pi. It works for more than just Rails apps.<p>I’ve tried a few other approaches in the past and this seems like the simplest, given a familiarity with git.<p>[1] <a href="https:&#x2F;&#x2F;kamal-deploy.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;kamal-deploy.org&#x2F;</a>
42lux4 months ago
After using nginx and caddy for some time I can&#x27;t fathom going back to apache config files.
评论 #42756018 未加载
评论 #42755954 未加载
a1o4 months ago
Hey, if one is only using apache and serving static files, is there any security issue one needs to be in the lookout? I was surprised fail2ban was the only thing installed there and it seems reliably working.
评论 #42756283 未加载
coolThingsFirst4 months ago
The caveat: only is possible if your ISP permits incoming connections.
freetonik4 months ago
Nice work, thanks for sharing! Do you plan to implement an RSS feed?
评论 #42760504 未加载
reassess_blind4 months ago
Any DDoS protection? Doesn&#x27;t really matter with a small personal site, but I run a few solo production apps and they get hit multiple times a month by &gt;100k rps DDoS attacks.
评论 #42756408 未加载
yustreparting4 months ago
Nice description, very helpful, thanks. IFAIK there’s a mixup between the words „permanent“ vs „temporary“ in the fail2ban section, you may want to check that.
评论 #42760989 未加载
tracker14 months ago
Curious how well Caddy would run on an RPi. Not sure if it would come out ahead of Apache in practice. It&#x27;s been my goto choice for a few years.
评论 #42755271 未加载
评论 #42755246 未加载
generichuman4 months ago
<a href="https:&#x2F;&#x2F;archive.md&#x2F;cvzgy" rel="nofollow">https:&#x2F;&#x2F;archive.md&#x2F;cvzgy</a><p>(was down for me, this fixed it)
richylarue4 months ago
I was looking for something like this article. Thanks for the post. Neat.
评论 #42761092 未加载
mikae14 months ago
Address Not Found
LtWorf4 months ago
Isn&#x27;t this the normal way?
xyst4 months ago
Already hugged to death, rip
评论 #42754983 未加载
评论 #42754696 未加载