I see so many posts and people who run NGINX as their reverse proxy. Why though? There’s HAProxy and Apache, with Caddy being a simpler option.

If you’re starting from scratch, why did you pick/are you picking NGINX over the others?

  • kolorafa@lemmy.world
    link
    fedilink
    English
    arrow-up
    68
    arrow-down
    2
    ·
    edit-2
    1 month ago

    Because Nginx Proxy Manager exists.

    And also because for me it started from web hosting where Apache and Nginx dominate and later because of many easy to understand example configs from the net including many “docker letsencrypt” examples.

    • Takahe@lemmy.nz
      link
      fedilink
      English
      arrow-up
      18
      arrow-down
      1
      ·
      1 month ago

      Very much became it exist. Its way simpler to do in the GUI.

      Did not have to learn anything specific, and can work for things not in docker containers too, like the Nextcloud Snap.

  • tombond@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 month ago

    Me personally, as a newb regarding proxy and homelab, I use nginx because it was super easy to set up (proxmox script) there were many tutorials available and it just works great. I had to debug some things and this also worked great, so just a perfect package.

  • vzq@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    Often I already have nginx running for serving some static content anyway.

    Otherwise, I’m traefik all the way.

      • jimmy90@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        Would that lack the performance benefits that pingora provides by being compiled without configuration file?

      • jimmy90@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        Yep it would need to be compiled from the configuration given. I’m vaguely interested in trying. I will look up the rust builders. Thank you

    • Silver Golden@lemmy.brendan.ie
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 month ago

      This is it for me. I used to use caddy a few years ago because writing config files was a breeze. Now I “use” nginx because I can define everything in a few lines of nix and it’s configured automagically for me.

      • jimmy90@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        Yeah I love that about nix and I can imagine a clever package writer can make a pingora binary to mimic that configurabllity

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 month ago

    There’s a lot of good resources for Nginx, it’s fast (faster than Caddy), and has a ton of features, so you can use it for pretty much anything HAProxy, Apache, or Caddy can do, and not sacrifice much in performance.

    That said, I mostly use HAProxy and Caddy. Here’s my basic setup:

    1. HAProxy at the edge VPS - routes requests to machines based on SNI
    2. WireGuard VPN - connects my internal devices to my VPS
    3. Caddy in Docker - runs on internal network on my NAS/homelab - manages LetsEncrypt renewals and reverse proxies to internal Docker network
    4. Nginx in Docker - FE for NextCloud; this simplifies things so all my TLS is handled in one place, and Caddy doesn’t need to touch files

    I use a local DNS server on my router so my domains can route directly to Caddy instead of going over the internet when on my network, otherwise I may just have HAProxy handle LetsEncrypt certificates.

    From what I can tell, Nginx is a little more efficient than Caddy, but Caddy is plenty fast for my needs. I’m considering switching from NextCloud to the new ownCloud Infinite Scale, and if I do, I’d ditch nginx completely.

  • udon@lemmy.world
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    1
    ·
    1 month ago

    Counter question: Why does everyone call it “engine X” and not “enjinx”, which would be the way cooler pronunciation?

  • 0x0@programming.dev
    link
    fedilink
    English
    arrow-up
    22
    arrow-down
    1
    ·
    1 month ago

    When NGINX showed up it beat the then dominant apache on resource utilzation hands-down.

    It’s also very configurable and has a lot of modules, both in-house and third party.

    The only downside for me: as of late the whole commercial part of the project has been gobbling up everything to shove the non-free version to the point where it’s hard to find info on the free version, e.g., the wiki page that lists all the third-party modules. The nginxtutorials site seems to be a good resource.

    Btw one of the main devs forked it into freenginx:

    Dounin writes in his announcement that “new non-technical management” at F5 “recently decided that they know better how to run open source projects. In particular, they decided to interfere with security policy nginx uses for years, ignoring both the policy and developers’ position.” While it was “quite understandable,” given their ownership, Dounin wrote that it means he was “no longer able to control which changes are made in nginx,” hence his departure and fork.

    Also, fun fact: this is probably the only instance of russian software muricans don’t cry Commie! all the time (maybe because the parent company was acquired).

  • s38b35M5@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    I’m reminded of this blog/article on Ars about ripping out OLS and reverting to NGINX. There’s some good info there, and also links to other of his posts on the subject and references. Good read.

  • liliumstar@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    25
    ·
    1 month ago

    Good question. I chose it initially because it was open source and way easier (in my eyes) than Apache. I don’t recall the others being an option at the time, or I was not aware of them. nginx does what I need without complaint, so I haven’t switched.

    • mystik@lemmy.world
      link
      fedilink
      English
      arrow-up
      19
      ·
      1 month ago

      At $dayjob I switched from Apache to nginx 15+ years ago. It’s Callback/Event based process model ran circles around Apache’s pre-fork model at the time. It was very carefully developed to be secure, and even early on it had a good track record. Being able to have nginx handle static content without tying up a backend worker process was huge, and let us scale our app pretty well for the investment of time. Since then, Apache implemented threaded + Event based process models, Caddy, traefik, and a bunch of others have entered the scene.

      TBH, I think the big thing nowadays is sane defaults, and better configuration, even automatically discovered configuration – traefik is my current favorite for discovering hosts in consul/Kubernetes/simple host definition files, but since traefik can’t directly serve files, I simply proxy from traefik to … nginx :)

  • tills13@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 month ago

    Caddy’s developer gives me the ick. He’s way too pompous in PRs on GH. nginx is just a constant – it does exactly what you need to and does it well.

  • d00phy@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    I use nginx & docker-proxy. Because the model I copied used that setup. Having messed with it a bit, I’m understanding it more and more. Before that, the last time I messed with a web server (Apache), nginx wasn’t around. Lately, I’ve seen a similar docker setup to mine that doesn’t use docker-proxy. If I find time, I’ll probably play with that some on my dev rig.

  • hendrik@palaver.p3x.de
    link
    fedilink
    English
    arrow-up
    25
    ·
    edit-2
    1 month ago

    It’s easy to use, reliable, and doubles as a webserver so I only need one software to host my websites and also do the reverse proxying to the other webservices.

  • wjs018@lemmy.world
    link
    fedilink
    English
    arrow-up
    83
    ·
    1 month ago

    Some good answers in here already. It boils down to a couple points for me:

    • Back when I started selfhosting, it was either nginx or apache, and I found nginx better and easier to set up
    • All the nginx knowledge I learned years ago still works just the same as it did back then, so why potentially mess things up by switching if it all still works
    • Basically every project has an example nginx config for reference, that can’t be said about other proxies
    • It is easier to find support online for edge cases that might pop up with nginx due to the ubiquity of its use and years of history