{"id":16713921,"url":"https://github.com/shepmaster/nginx-template-image","last_synced_at":"2025-03-21T20:33:34.689Z","repository":{"id":16429044,"uuid":"19180418","full_name":"shepmaster/nginx-template-image","owner":"shepmaster","description":"Allow Docker environment variables in nginx configuration files","archived":false,"fork":false,"pushed_at":"2014-11-10T19:42:53.000Z","size":222,"stargazers_count":38,"open_issues_count":2,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-18T04:52:14.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shepmaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-26T15:15:56.000Z","updated_at":"2024-12-18T01:52:58.000Z","dependencies_parsed_at":"2022-09-02T14:44:15.424Z","dependency_job_id":null,"html_url":"https://github.com/shepmaster/nginx-template-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Fnginx-template-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Fnginx-template-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Fnginx-template-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Fnginx-template-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shepmaster","download_url":"https://codeload.github.com/shepmaster/nginx-template-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244866373,"owners_count":20523503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:48:33.893Z","updated_at":"2025-03-21T20:33:34.399Z","avatar_url":"https://github.com/shepmaster.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nginx-template-image\n\nThis container allows you to use the environment variables set by a\nDocker link inside of your nginx configuration.\n\n## Usage\n\nMount your configuration to `/etc/nginx/sites-templates`, preferably\nread-only. To capture logs, mount a writable directory to\n`/var/log/nginx`.\n\nBoth HTTP (80) and HTTPS (443) ports are exposed.\n\nFor example:\n\n```\ndocker run \\\n  --publish 8080:80 \\\n  --publish 8443:443 \\\n  --volume /tmp/nginx-config:/etc/nginx/sites-templates:ro \\\n  --volume /tmp/nginx-logs:/var/log/nginx \\\n  --link my-rails-app:rails \\\n  shepmaster/nginx-template-image\n```\n\n### Example nginx config\n\nThis is just an example of how to use the templating with a linked\ncontainer named `rails`, and should not be treated as an nginx\nconfiguration guide!\n\n```\n# mount this as /etc/nginx/sites-templates/cool-app.conf.tmpl\n# will be available as /etc/nginx/sites-enabled/cool-app.conf\n\nserver {\n  listen       80;\n  server_name  my-cool-app.dev;\n\n  location / {\n    if (!-f $request_filename) {\n      proxy_pass   http://${RAILS_PORT_3000_TCP_ADDR}:${RAILS_PORT_3000_TCP_PORT};\n      break;\n    }\n  }\n}\n```\n\n## Further information\n\n### Environment variables\n\nDocker links are communicated via environment variables, but nginx\ndoes not easily allow environment variables in configuration files.\n\nTo work around this, configuration files mounted at\n`/etc/nginx/sites-templates` will be copied to\n`/etc/nginx/sites-enabled`. Any file that ends with `.tmpl` will have\nvariable references like `${FOO}` replaced with the corresponding\nenvironment variable and have the `.tmpl` suffix removed.\n\n### Only include .conf files\n\nThe default nginx configuration includes all files in `sites-enabled`,\nwhich makes it difficult to have supplemental files like SSL keys in\nthe same directory. This container will only load files that end in\n`.conf`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepmaster%2Fnginx-template-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshepmaster%2Fnginx-template-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepmaster%2Fnginx-template-image/lists"}