A nginx server wrapper for angular apps
521
A lightweight, production-ready Nginx wrapper specifically optimized for Angular applications (v17+). This image is designed to be used as a standalone web server or behind a reverse proxy like nginx-proxy with automatic SSL.
The easiest way to use this image is to point it at your Angular browser folder (the output of ng build. dist>appname>browser).
services:
web:
image: rexorbrave/angular-nginx-server:latest
ports:
- "8080:80"
environment:
- API_UPSTREAM=nodejs-api # OPTIONAL: This matches the service name of the api
- API_PORT=3000 # OPTIONAL: The port on which the API listens
volumes:
# Map your local 'browser' folder to the container
- ./dist/my-app/browser:/var/www/angular-app:ro
Automatic HTTPS (with nginx-proxy & ACME)
If you are using the nginx-proxy and acme-companion stack, use this configuration:
services:
web:
image: rexorbrave/angular-nginx-server:latest
expose:
- "80"
environment:
- API_UPSTREAM=nodejs-api # OPTIONAL: This matches the service name of the api
- API_PORT=3000 # OPTIONAL: The port on which the API listens
- VIRTUAL_HOST=yourdomain.com
- LETSENCRYPT_HOST=yourdomain.com
volumes:
- ./browser:/var/www/angular-app:ro
networks:
- proxy-network
networks:
proxy-network:
external: true
Modern Angular builds (especially with Prerendering/SSG) produce a browser folder. Standard Nginx images require you to manually write a config to handle Angular's Client Side Routing. This image handles that logic out of the box, ensuring that routes like /dashboard or /profile work even when deep-linked or refreshed.
Content type
Image
Digest
sha256:5529d7c7c…
Size
24.7 MB
Last updated
8 months ago
docker pull rexorbrave/angular-nginx-server