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
    27
    edit-2
    2 years 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.

    • psykon
      link
      fedilink
      92 years 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.

  • Shimitar
    link
    fedilink
    English
    172 years ago

    Nginx! Simplex essential and easy.

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

  • @vegetaaaaaaa
    link
    English
    8
    edit-2
    2 years 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.

    • @[email protected]
      link
      fedilink
      English
      22 years 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
        link
        English
        12 years 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>
        
        • @[email protected]
          link
          fedilink
          English
          12 years 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.

  • @[email protected]
    link
    fedilink
    English
    82 years 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.

    • @rambos
      link
      12 years ago

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

  • @[email protected]
    link
    fedilink
    English
    62 years ago

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

  • hitagi
    link
    fedilink
    English
    5
    edit-2
    2 years ago

    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.

  • Meow.tar.gz
    link
    fedilink
    English
    42 years ago

    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.

  • @SniffBark
    link
    English
    42 years 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.

  • @[email protected]
    link
    fedilink
    English
    32 years ago

    Apache httpd if php is involved. Otherwise, nginx.

    Both are highly reliable and efficient.

    • @[email protected]
      link
      fedilink
      English
      32 years ago

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

  • Matt The Horwood
    link
    fedilink
    English
    3
    edit-2
    2 years 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

  • Qazwsxedcrfv000
    link
    fedilink
    English
    32 years ago

    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.

    • asudoxOP
      link
      English
      12 years ago

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

      • Qazwsxedcrfv000
        link
        fedilink
        English
        02 years ago

        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.