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.

  • d_k_bo@feddit.de
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    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.

    • psykon@kbin.social
      link
      fedilink
      arrow-up
      2
      ·
      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.

  • SniffBark@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    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.

  • 2tapry@lemmy.nz
    link
    fedilink
    English
    arrow-up
    2
    ·
    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.

  • Qazwsxedcrfv000@lemmy.unknownsys.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year 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.

  • Matt The Horwood@lemmy.horwood.cloud
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    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
    link
    fedilink
    English
    arrow-up
    0
    ·
    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.worldOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      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
        link
        fedilink
        English
        arrow-up
        0
        ·
        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.

          • Meow.tar.gz@lemmy.goblackcat.com
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            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.

      • innercitadel@lemmy.nz
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        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@kglitch.social
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          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.

  • vegetaaaaaaa@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    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
      link
      fedilink
      English
      arrow-up
      2
      ·
      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
        link
        fedilink
        English
        arrow-up
        1
        ·
        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
          link
          fedilink
          English
          arrow-up
          1
          ·
          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.

  • Shimitar@feddit.it
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago

    Nginx! Simplex essential and easy.

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

  • purahna@lemmygrad.ml
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    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.

      • purahna@lemmygrad.ml
        link
        fedilink
        English
        arrow-up
        0
        arrow-down
        1
        ·
        1 year ago

        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.