4
4 Comments

Do you need NGINX to serve static content if you are using a CDN?

Basically what it says on the tin. I'd rather not muck around with NGINX and just serve static files straight from the app server. I like having all the routing at once place.

Since something like cloudflare is a reverse proxy and caches static content, can you get away with not having nginx in front of your app server?

on October 10, 2019
  1. 3

    What level of traffic are you getting and what's your back-end?

    My last project didn't use Nginx at all. My current one does, but not for performance but because it made some things convenient like Letsencrypt certs and acting as a reverse proxy for multiple separate apps. My projects are pretty much all on Phoenix Framework these days, though, and Elixir is very performant as a web server.

    Circling back to my initial question, I suspect you're very far from actually needing to worry about caching static assets.

    1. 1

      I'm doing all the pages around the app, the landing page, the login page etc. I wanted to keep doing my routing in express.js, and not have to add nginx in later on, so wanted a quick sanity check.

      My server isn't exactly being thrashed right now. I think I'll continue down the route I'm on.

      1. 1

        Node/Express isn't great for performance, but it's not terrible either.

        Even if you're on a cheap VPS, you should be able to handle the front page of HN without Nginx unless something else is horribly inefficient. If you're on a shared host (e.g. dreamhost, hostgator, etc), it might be cutting it close but you could still probably serve 100k+ monthly visitors with normally distributed traffic.

  2. 2

    I'm serving my frontend static files through my backend directly, and it works quite well. I don't even have a CDN in front.

    What would you try to solve with nginx, now that you've got a CDN already?