22

I want to host my website in my raspberry pi, I've read that I would need a web server software for this. Which one do you recommend? It won't be a complex website.

top 38 comments
sorted by: hot top controversial new old
[-] d_k_bo@feddit.de 18 points 1 year ago* (last edited 1 year ago)

Caddy! It has HTTPS built in and provides simple but powerful configuration with sane defaults.

Example Caddyfile for a static file server:

example.com {
	root * /var/www
	file_server
}

I used nginx in the past, but didn't like it's verbose config files.

[-] cestvrai@lemm.ee 7 points 1 year ago

The first open source contribution I made was to caddy!

[-] psykon@kbin.social 4 points 1 year ago

+1 for Caddy. It's my default webserver and reverse proxy. Built-in Https and the fact that I can get it up, running and configured in a matter of minutes are the main reasons.

[-] vegetaaaaaaa@lemmy.world 9 points 1 year ago* (last edited 1 year ago)

Apache, the OG HTTP server. Fast, well documented, battle-tested, FOSS and community-led (unlike nginx which is corporate-led). People will tell you that nginx is "faster" but never point to actual benchmarks. Both are ok.

[-] slip@818.gallery 2 points 1 year ago

Yeah apache is awesome. Lots of settings if u want, and every question I've ever asked and probably am yet to ask has already been answered on stack with multiple duplicates aha

[-] vegetaaaaaaa@lemmy.world 1 points 1 year ago

Check out mod_md - this module allows getting certificates from Let's Encrypt (or any other ACME cert provider) automatically. Just set this anywhere in your config, reload apache and you're set. No more fiddling around with certbot.

MDCertificateAgreement accepted
MDContactEmail me@example.org
MDomain my.example.org

Also other comments make it look like only nginx supports FastCGI (e.g. php-fpm), apache has supported talking to FastCGI since 2005:

  <FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
  </FilesMatch>
[-] slip@818.gallery 1 points 1 year ago

Yeah I use php-fpm, I didn't know much about it the first time I installed it, I just needed it for HTTP 2.

For ssl I just install certbot and let it autorun LetsEncrypt, I haven't had any issues with any of my ssl certs, it's pretty nice.

The age old LAMP stack is pretty solid, except for me it's LAPP cuz I don't wanna use mysql.

[-] 2tapry@lemmy.nz 6 points 1 year ago

nginx

Not sure why others are suggesting a Raspberry Pi and nginx would cause problems? I run three public facing websites on a single Raspberry Pi 4 with 2GB RAM. Has been working flawlessly for 2 years. Typical uptime is measured in multiple months.

Running Wordpress, fail2ban and certbot. Booting and running of a USB drive - have considered SSD but no need as I cache to RAM for performance.

[-] Shimitar@feddit.it 5 points 1 year ago

Nginx! Simplex essential and easy.

Unless you need to rely a lot on CGIs then apache maybe is better.

I use NGINX because it's what I'm familiar with. If I was starting again, I would probably use Caddy.

[-] SniffBark@lemmy.world 4 points 1 year ago

I have recently started using Caddy and I love it! FOSS, automatic HTTPS, super easy to setup and works well as a reverse proxy. As your website will not be complex, the Caddyfile would be just a few lines.

I would honestly go with Apache here. I use NGINX in my environment mainly as a reverse proxy. I do use NGINX to serve my static blog.

[-] cmeerw@programming.dev 3 points 1 year ago

lighttpd, just to be different

[-] radiated@lemm.ee 3 points 1 year ago
[-] resurge@lemmy.ml 2 points 1 year ago

Traefik can't serve html itself though, can it?
It can route requests to a web server, but it can't serve the files itself iirc.

This Stack Overflow post seems to confirm this: https://stackoverflow.com/questions/46503797/is-there-a-way-to-serve-static-resources-with-traefik

[-] kekvrose@sh.itjust.works 3 points 1 year ago

Apache httpd if php is involved. Otherwise, nginx.

Both are highly reliable and efficient.

[-] Hexarei@programming.dev 3 points 1 year ago

If running php, I usually go with PHP-FPM and nginx, much faster than Apache in most cases

[-] cnk@kbin.dk 3 points 1 year ago
[-] rambos@lemmy.world 1 points 1 year ago

There is a NPM (nginx proxy manager) with rly nice GUI that you can run in docker container

[-] namelivia@lemmy.world 3 points 1 year ago
[-] Semi-Hemi-Demigod@kbin.social 1 points 1 year ago

I'm a big fan of HAProxy

Is your site static or dynamic? If your site is made of good old HTML and CSS or your site is a SPA, any web server will serve it well.

I prefer Nginx as it is performant and versatile enough for most use cases.

[-] Asudox@lemmy.world 0 points 1 year ago

Static mostly, I will have a few dynamic pages though.

If your dynamic pages leverage PHP, Nginx can be configured to support that via FastCGI. If your site has its own server runtime (e.g. a site written with NodeJS or Go), Nginx reverse proxy is literally its strength. So yeah give Nginx a try. I bet you won't regret it.

[-] mhzawadi@lemmy.horwood.cloud 1 points 1 year ago* (last edited 1 year ago)

I only use nginx now, the out of box footprint is tiny.

add this deb https://packages.sury.org/nginx/ bookworm main to your /etc/apt/sources.list to install the latest stable

[-] innercitadel@lemmy.nz 0 points 1 year ago

Hosting personal websites on your own hardware is such a pain, and I would imaging doing it on a rpi would be even more of a pain than on x86 architecture. If at all an option I'd recommend hosting on something like github pages or better still on a VPS.

[-] Asudox@lemmy.world 2 points 1 year ago

Well thanks, I guess. But do you have a recommendation? I'm sure a simple website won't cause any problems on a raspberry pi.

[-] Double_A@discuss.tchncs.de 1 points 1 year ago

The main issue is not the website itself, but opening your network to be reachable from the internet in a safe way.

How so? I've been doing it for 6 months or so now without issue.

[-] orcrist@kbin.social 1 points 1 year ago

I hosted websites on my own hardware for 20 years and it worked out well Recently I've been using a VPS, and that has many benefits and drawbacks. Is it worth paying for the VPS? Maybe. That all depends on your situation.

[-] innercitadel@lemmy.nz 2 points 1 year ago* (last edited 1 year ago)

I run 4 websites on my one VPS, and 2 websites on another more restricted cloud container service. Three wordpress, one DICOM server and viewer (radiology image database), one moodle, and one complex git mediawiki setup. Plus some sandbox stuff. Get about 10,000 unique views a day in total across all sites.

I don't know enough about network security to run that safely nor how to get great uptime at home as I run it all single handed and my day job has little to do with computers (am a medical doctor). I do expose some docker apps to the internet that run on my home server but they are only used by friends and family.

When I've needed temporary simple static web pages I've used jekyll on github pages and found it great.

load more comments
view more: next ›
this post was submitted on 11 Jul 2023
22 points (100.0% liked)

Selfhosted

40134 readers
684 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS