nginx-proxy / nginx-proxy/nginx-proxy
Config using environment variables
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 19.9k
- Forks
- 3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 1
Description
Currently the only way to set a global or per-vhost config is to mount a corresponding conf file into nginx container. Even though it can be done via creating custom container or mounting a volume with config files, using env vars would be more easy and effortless. My proposition is as follows:
At startup, scan all env vars starting with NGINX_* and add corresponding entries to /etc/nginx/conf.d/environment.conf and for each vhost do the same for hosts env vars. This way we would avoid hardcoding and maintaining an array of possible env variable names. Example usage from docker-compose:
services:
nginx:
image: jwilder/nginx-proxy
environment:
NGINX_CLIENT_MAX_BODY_SIZE: 30M
ports:
- 80:80
...
app:
image: app
environment:
VIRTUAL_HOST: example.com
NGINX_ACCESS_LOG: 'off'
or from the command line:
docker run -d -p 80:80 -e NGINX_CLIENT_MAX_BODY_SIZE=30M ... jwilder/nginx-proxy
There are 2 related issues #597 and #688 but they are a few years old and unanswered.
Is there interest for implementing this? I can try to do it. Maybe a similar solution already exists?
Or is it a bad idea? If so, why?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the nginx container startup path and inspect how configuration is currently generated and how /etc/nginx/conf.d is populated. Define how NGINX_* variables and per-vhost host variables map to configuration entries, then verify that generated global and virtual-host configuration is accepted by nginx and supports the examples in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, nginx
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100