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.

@[email protected]
link
fedilink
English
32Y

Apache httpd if php is involved. Otherwise, nginx.

Both are highly reliable and efficient.

@[email protected]
link
fedilink
English
32Y

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

@[email protected]
link
fedilink
English
62Y

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

@[email protected]
link
fedilink
English
52Y

Nginx

@[email protected]
link
fedilink
English
7
edit-2
2Y

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.

@[email protected]
link
fedilink
English
22Y

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

@[email protected]
link
fedilink
English
12Y

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 [email protected]
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>
@[email protected]
link
fedilink
English
12Y

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.

@[email protected]
link
fedilink
English
82Y

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.

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

hitagi
link
fedilink
English
5
edit-2
2Y

Caddy was my first and it’s very easy to use. I use nginx nowadays because I heard it scales better. It’s harder to use but manageable enough.

Depending on the type of website you’re hosting, you can probably just use Cloudflare pages or Netlify instead of hosting it at home with a Pi.

I’m a big fan of HAProxy

@[email protected]
link
fedilink
English
-82Y

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.

@[email protected]
creator
link
fedilink
English
42Y

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.

@[email protected]
link
fedilink
English
22Y

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

metaStatic
link
fedilink
32Y

and sometimes you literally can’t. see CG-NAT, something my ISP is doing, so fuck me right.

Meow.tar.gz
link
fedilink
22Y

Yeah CGNAT makes things a pain in the ass but it’s not a show stopper. Get a cheapie cloud VPS and install NGINX Proxy Manager (NPM) on it. Then do a WireGuard tunnel between your server and the cloud VPS. Problem solved. Or you could use Cloudflare tunnels but I wouldn’t recommend that.

@[email protected]
link
fedilink
English
62Y

Lol, I wonder what terrible programming language you’re working in. Why would you need x86 to host a website?

@[email protected]
link
fedilink
English
02Y

Ah OK, I might have assumed wrong then that running a server on ARM is a little trickier. Never done it. Only ever used nginx for my websites on my VPS. Don’t want to deal with the security and uptime headaches of running my websites on my home server.

kglitch
link
fedilink
3
edit-2
2Y

I was a bit nervous about this too but I just set up a kbin instance on ARM (nginx, php, postgres, redis, and more) and didn’t notice any difference. Totally straightforward. And the VPS costs half as much as the x86 equivalent from the same host.

Oh wow genuinely interesting. Thanks, I’ve learned something. I had the wrong impression.

@railsdev @innercitadel Do you not write your web apps in assembler…?

Meow.tar.gz
link
fedilink
English
12Y

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

orcrist
link
fedilink
22Y

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.

@[email protected]
link
fedilink
3
edit-2
2Y

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.

@[email protected]
link
fedilink
English
27
edit-2
2Y

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.

@[email protected]
cake
link
fedilink
English
92Y

The first open source contribution I made was to caddy!

psykon
link
fedilink
92Y

+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.

Matt The Horwood
link
fedilink
English
3
edit-2
2Y

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

Qazwsxedcrfv000
link
fedilink
English
32Y

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.

@[email protected]
creator
link
fedilink
English
12Y

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

Qazwsxedcrfv000
link
fedilink
English
02Y

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.

@[email protected]
link
fedilink
English
02Y

I always love Flask for this, it’s a super simple python web server that is basically fully batteries included, just write a couple lines of python and throw your html in either /static or /templates, depending on whether it’s dynamic or not, and you’re live. It’s not gonna move mountains but it’s not meant to.

@[email protected]
creator
link
fedilink
English
12Y

How is the performance compared to nginx or apache?

@[email protected]
link
fedilink
English
02Y

Much lower and you shouldn’t care. As long as you’re serving less than one request per second, you will not need to care about performance. If you do, sanic and vibora are drop-in flask replacements and they are both much more performant.

@[email protected]
link
fedilink
English
22Y

I imagine you’d probably put Flask behind nginx. At least in Ruby (another interpreted language) I don’t want all requests hitting the framework.

@[email protected]
creator
link
fedilink
English
12Y

I currently read that Flask is not good for production. They say I can use something like waitress. If possible I’d use something like that over nginx for simplicity’s sake.

@[email protected]
link
fedilink
English
42Y

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.

Shimitar
link
fedilink
English
172Y

Nginx! Simplex essential and easy.

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

Create a post

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:

  • Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.
  • No spam posting.
  • Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.
  • Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
  • No trolling.

Resources:

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

> Questions? DM the mods!

  • 1 user online
  • 218 users / day
  • 9 users / week
  • 244 users / month
  • 841 users / 6 months
  • 0 subscribers
  • 542 Posts
  • 8.93K Comments
  • Modlog