I am really confused. I am trying to deploy an Angular application on my Virtual Private Server (in the cloud). My ultimate goal is to make my ng app communicate with my .Net Api that itself communicates with a PostgreSQL database.
I use docker for everything, on my VPS. Problem is, I understand so little about docker and nginx configurations .
I have nginx installed on my VPS and I installed SSL certificates, so the connection is already "secure".
But I deploy my angular application in a docker container with another nginx configuration, as "unprivileged". I did 99% the same as here https://docs.docker.com/guides/angular/containerize/. And my .NET API is 99% the .NET API with docker preinstalled, its basically a hello world application with a health check endpoint (I really try to advance step by step).
My first question would be : How should my ng app communicate with my .Net API ? Should I also include the API in the nginx configuration that is used for the angular application, and make it a reverse proxy to communicate with the API?
I thought that it would not be a good idea, since I already did that once and it kind of made my API "public". I mean, if I wrote in a browser the address https://mysite.be/api/health for example (my Domain is not "mysite", but that's the idea), it would display the healthcheck response from the api ("Healthy") on the page, pure string. So 100% public, right ? Is it not a bad idea ? How should I do ?
Thanks in advance for any answer. I will obviously stay here to answer further questions, in case I didn't provide enough details !
I wanted to provide more information, like the Dockerfiles of my API and ng app, or the nginx.conf and docker compose files, but I would need to be sure that nothing is "secret". Idk if I should post them here ?
Learn how to containerize an Angular application with Docker by creating an optimized, production-ready image using best practices for performance, security, and scalability.