Overview
This template provides a production‑ready Nginx instance as a Monk runnable. You can:- Run it directly to get a managed Nginx web server with sensible defaults
- Inherit it in your own runnable to serve static content, reverse proxy, or load balance traffic
What this template manages
- Nginx container (
nginximage, configurable tag) - Network services on ports 80 (HTTP) and 443 (HTTPS)
- Custom nginx.conf configuration
- Static content serving
- Reverse proxy capabilities
Quick start (run directly)
- Load templates
- Run Nginx with defaults
- Customize configuration (recommended via inheritance)
variables. Configuration added with custom files will not affect this runnable unless you inherit it and override those files.
- Preferred: inherit and customize variables or files as shown below.
- Alternative: fork/clone and edit the
variablesinnginx/nginx.yaml, thenmonk load MANIFESTand run.
http://localhost:80.
Configuration
Key variables you can customize in this template:files section in the template. Static content and configuration files are typically mounted from the host or defined inline.
Use by inheritance (recommended for apps)
Inherit the Nginx runnable in your application to create a reverse proxy or serve static content. Example:Ports and connectivity
- Service:
nginxon TCP port80(HTTP) and443(HTTPS) - From other runnables in the same process group, use
connection-hostname("\<connection-name>")to resolve the Nginx host.
Persistence and configuration
- Configuration files can be mounted via the
filessection in your runnable definition. - Static content can be served by mounting host directories or defining inline content.
- SSL/TLS certificates should be mounted from the host or provided via secrets management.
- Logs are available via
monk logscommand or can be persisted to host volumes if needed.
Features
- High-performance static file serving
- Reverse proxy with caching
- Load balancing (round-robin, least connections, IP hash)
- SSL/TLS termination
- HTTP/2 support
- WebSocket proxying
- URL rewriting and redirects
- Access control and rate limiting
Use cases
Nginx excels at:- Serving static websites and assets
- Reverse proxy for microservices
- Load balancing across application servers
- SSL/TLS termination
- API gateway
- Content caching
Related templates
- Combine with application backends (Node.js, Python, PHP)
- Use
certbot/ortraefik/for SSL/TLS certificates - Integrate with
prometheus-grafana/for monitoring
Troubleshooting
- Test nginx configuration syntax:
- Verify Nginx is responding:
- For SSL/HTTPS setup, ensure certificates are properly mounted and paths are correct.
- If configuration changes don’t take effect, ensure you’ve reloaded or restarted the container.
- Check logs: