14
erandria
62d

I'm learning nginx and it's simplying the way I think about web projects.

I used to think that when I used a server side framework, then that should be the master and all should go through it. Noob me.

I used to put client side projects (like create-react-app of vue-cli projects) right inside the server side project.

But with nginx you can just route subpaths to different places, then instead of having, let's say, the react project inside rails, they would be in separate git projects.

In fact, I no longer need to restrict myself to a single server framework.

I love several aspects of rails. I love several others of node. And if I need multithreaded performance, I'd very much use something like phoenix or go.

Again, with nginx, you setup subpaths with the `location` directive in the same server and voila, a no CORS setup, cookies shared and homogenous versatile website.

Comments
  • 2
    any particular tutorials you are using? i never looked at nginx myself and would love to try it out :D
  • 1
    @AleCx04 I'm in the same boat, I basically did trial and error and half-ass read the docs.

    I actually hated the way information is structured in some nginx docs. Like today I had to setup nginx to cache certain requests, and the stack overflow solution to my problem didn't seem to have a lot of emphasis in the nginx cache article.

    But man, that's another benefit I should have mentioned in the post. You can cache certain requests for local development, so when you refresh a page it instaloads. Very benefficial for the dev cycle.

    (and I guess you can fine tune that via nginx options and env vars).

    also, I run it locally on docker using `--net=host` and `--rm` args. More simple than installing, running it, reloading the config, etc.

    Maybe I should write a post about this.
  • 2
  • 1
    @erandria @lamka02sk thanks guys! i will definitely look more into it
  • 1
    You could check this blog post from devdungeon, I hope it helps

    https://devdungeon.com/content/...
  • 1
    Well, I know what to do this weekend! Thanks everyone for the links
  • 0
    Isn't devrant run on nginx? Get the "how devrant runs on nginx" guide, would totally buy for a buck or two
  • 0
    Am I right in saying that this is using nginx as a reverse proxy to serve multiple services from one domain?

    If anyone is using docker containers or kubernetes, then traefik is also another good option that was designed to be a reverse proxy for docker/kubernetes
Add Comment