{"id":18260029,"url":"https://github.com/roppa/custom-nginx","last_synced_at":"2026-02-13T15:11:28.182Z","repository":{"id":146092921,"uuid":"71453952","full_name":"roppa/custom-nginx","owner":"roppa","description":null,"archived":false,"fork":false,"pushed_at":"2016-10-27T15:42:55.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-08T23:44:30.965Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roppa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-20T10:53:46.000Z","updated_at":"2025-01-01T06:08:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"ddf9aa78-5eed-4477-a01c-f7ec5854bf9a","html_url":"https://github.com/roppa/custom-nginx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/roppa/custom-nginx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Fcustom-nginx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Fcustom-nginx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Fcustom-nginx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Fcustom-nginx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roppa","download_url":"https://codeload.github.com/roppa/custom-nginx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Fcustom-nginx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272619672,"owners_count":24965416,"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","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-05T10:41:35.253Z","updated_at":"2026-02-13T15:11:28.148Z","avatar_url":"https://github.com/roppa.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom nginx\n\nThe driving criteria for custom nginx containers is to:\n\n- be able to create an nginx instance, passing in custom variables/custom conf files\n- log error to stderr and access logs to stdout\n- be able to test a container running nginx\n\n## Overview\n\nOur custom nginx image is based on the latest nginx vendor image.\n\nThis custom nginx has a base config file which sets charset, gzip, mime types, and log format.\n\nWe set specific folders for your sites config, an includes folder, and html folder.\n\nThe ```/etc/nginx/sites/``` folder is intended for you to attach your own ```.conf``` file.\n\nThe ```etc/nginx/includes/``` folder is intended for any includes you need in your conf file.\n\nThe ```/usr/share/nginx/html/``` folder is intended for your static assets.\n\n## Running\n\nThere are many ways to run this. An example exists in the /test folder and the ```docker-compose.yml``` file in the root of this directory. The ```docker-compose.yml``` creates a container from the base image and mounts the folders (sites, html, config) using the command line.\n\nAnother approach is to attach the html/static assets is via a data container. In your SPA repository, build your site into a ```/dist``` folder for example (see '/data-volume-example'). Then create a data volume, adding the contents from '/dist':\n\n```\ndocker create -v $(pwd)/dist:/usr/share/nginx/html --name html-dist debian /bin/true\n```\n\nThen create your nginx instance with your config file (but not adding any html):\n\n```\nFROM customnginx\nCOPY site.conf /etc/nginx/sites\n```\n\nThen build using something like:\n\n```\ndocker build -t testcustom .\n```\n\nOnce your image is built, you can run and attach your data volume using ```--volumes-from```:\n\n```\ndocker run -d -p 8800:80 -v /usr/share/nginx/html --volumes-from html-dist testcustom\n```\n\nIn this way you can keep your distribution code separate from your bespoke nginx, and for any other nginx instances that are span up the distribution files can be attached. This could be set to read only too (:ro).\n\nAnother way is to create a Dockerfile based on the custom container (next section).\n\n## Building the default image\n\nCreate the base image in your repo (see '/bespoke-example'):\n\n```\ndocker build -t [default image name] .\n```\n\nThen, in your specific Docker file use ```FROM [default image name]```. For example:\n\n```\nFROM customnginx\n\nCOPY site.conf /etc/nginx/sites\nCOPY ./html /usr/share/nginx/html\n```\n\n## Testing\n\nThe ```test``` folder contains the site/test.conf file, and the html folder. It is run manually at the moment using docker compose i.e. ```docker-compose up --build```.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froppa%2Fcustom-nginx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froppa%2Fcustom-nginx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froppa%2Fcustom-nginx/lists"}