Nginx/Unit and Docker

What is your experience with Nginx/Unit? Anybody gotten NodeJS installed as a web server in NgInx/Unit?

Background
I would like to release an Angular/NodeJS app on Docker/AWS and can’t even get NodeJS to work in a docker container.

No doubt, this is an end-user issue so I am looking for suggestions on what to read and code snippets.

Thoughts?

Is your nginx in docker also or is it going to be independent?

Ngninx/unit will be in Docker.

Thanks.

NgInx/Unit is a single Docker image and I believe is designed for a single container. Am I correct?

I am trying to run this as a single container since this is a largely private service.

I’m not a nodejs user but, you can build your own image with docker to have nginx and nodejs installed. Or you can have a nginx container and a nodejs container (2 separate containers) on the same docker network. Just depends on how you want to build it out on your server. Both methods are safe from a security standpoint.

If you want 2 separate containers then you can write a nifty docker-compose.yml file to build your environment and save it in github if/when disaster strikes so you can rebuild it quick.

A good concept. I am coming to believe the Compose solution is the correct one, so thanks.

I am currently looking for the best “pair” of services. I need a middleware router like Nginx that needs to split traffic between the web server and the app server. The more I look at the “NgInx-Unit” package the more I wonder if it is too bloated. Finding two smaller sized solutions would be golden. The goal is to get something that deploys cheaply on AWS since I don’t need a full AWS redundant system.

Thanks for commenting.

I’m not really sure what the difference is between nginx and nginx-unit. I read an article HERE and their bullet point for the downside to using nginx-unit is Go and Node.js codebases have to be modified to work with NGINX Unit.

I’m not really sure of all your requirements but, you can use the nodejs and nignx containers for your stack.
https://hub.docker.com/_/node
https://hub.docker.com/_/nginx

The non-functional requirements was to use one “server” for both API based requests and Web based requests. The NgInx Unit product is designed to do this, or so they say. Both API and Web requests on this private server will be light.

I am still in the design phase and am revisiting requirements. I am starting to think Unit is too bloated. If Init won’t fit on a small server I may not be able to use Unit:-)

Thanks for responding.

ohhhh ok I get what nginx-unit is about now. You want the API to update your listeners and applications and how it routes. Sounds like a fun project. I did a bit more digging and looks like nginx has an official docker image for nginx-unit compiled for node18 docker.io/nginx/unit:1.29.1-node18.

More about the initial setup can be found here

Yes.

APIs are more than just admin control.

Yes I am playing with the NgInx/Unit/Node18 build. Unfortunately I haven’t figured out how to get the stack to even work with a simple NodeJS “hello world” hence my newbie issue. NgInx Docker, on the other hand, just worked. The Unit Docker image is huge hence my bloated concept.

The APIs will respond do a different url i.e. https://example.com/api. Nginx would route all /api to applications written in go, php, NodeJS, etc. the APIs would be tightly secured and would access databases, queues and the like. Dynamic web pages would access the API for databases etc. IOS apps would access the APIs to perform operations on a database.

That is where this all started. Now with good info from this forum I am also looking at other info. On top of this, NgInx, and its friends like Unit, has been purchased by F5. I suspect F5 would rather have all this stuff separate hence making examples examples may not be a high priority

Thanks again.