{"id":16863112,"url":"https://github.com/leesei/docker-nginx-cors","last_synced_at":"2026-04-10T23:46:23.760Z","repository":{"id":152175436,"uuid":"63300748","full_name":"leesei/docker-nginx-cors","owner":"leesei","description":"Serve a folder with Docker's `nginx:alpine`, with CORS, HTTPS and .htaccess configs available.","archived":false,"fork":false,"pushed_at":"2024-07-15T04:01:05.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T16:37:58.142Z","etag":null,"topics":["docker","nginx","shell-script"],"latest_commit_sha":null,"homepage":"","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/leesei.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-14T03:58:03.000Z","updated_at":"2025-02-13T00:23:52.000Z","dependencies_parsed_at":"2024-07-15T05:22:08.970Z","dependency_job_id":"8e602bb6-fd4e-4ec1-9f85-e5a3448cac55","html_url":"https://github.com/leesei/docker-nginx-cors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leesei/docker-nginx-cors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leesei%2Fdocker-nginx-cors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leesei%2Fdocker-nginx-cors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leesei%2Fdocker-nginx-cors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leesei%2Fdocker-nginx-cors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leesei","download_url":"https://codeload.github.com/leesei/docker-nginx-cors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leesei%2Fdocker-nginx-cors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259610343,"owners_count":22884242,"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":["docker","nginx","shell-script"],"created_at":"2024-10-13T14:37:44.818Z","updated_at":"2026-04-10T23:46:18.729Z","avatar_url":"https://github.com/leesei.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-nginx-cors\n\nA script for starting Docker's [`nginx:alpine`](https://github.com/nginxinc/docker-nginx/tree/master/mainline/alpine) image with CORS, and optionally HTTPS, on arbitrary folder and arbitrary port.\n\nThis is a script that load config files in the current directory rather than a Docker image. This allows for multiple instances of `docker-nginx-cors` running simultaneously with different configs.\n\n## Install\n\n```sh\ngit clone https://github.com/leesei/docker-nginx-cors\n```\n\n## Usage\n\n```sh\n./nserve -p 9000 ~/share\n```\n\nUse this command to verify the config of the created container:\n\n```sh\ndocker inspect --format=\"{{.Volumes}}\" [${CONTAINER_NAME}|${CONTAINER_ID}]\ndocker inspect --format=\"{{.Config.Labels}}\" [${CONTAINER_NAME}|${CONTAINER_ID}]\n\n# with [`jq`](https://stedolan.github.io/jq/manual/)\ndocker inspect [${CONTAINER_NAME}|${CONTAINER_ID}] | jq .[0].Volumes\ndocker inspect [${CONTAINER_NAME}|${CONTAINER_ID}] | jq .[0].Config.Labels\n```\n\nYou can also fork this repo and customize `nginx.conf`, `nginx.vh.default.conf` to fit your needs.\n\n### HTTPS\n\n- Place an certificate key pair in `conf.d/` (with name `https.{key,crt}`)\n- Enable `https.conf` include in `conf.d/default.conf`\n\nTo create self-signed certs:\n\n```sh\nopenssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx/conf.d/https.key -out nginx/conf.d/https.crt\n# fill the IP/domain of your server to \"Common Name\"\n# otherwise the browser will reject to connect to the server\n```\n\n### Access Control\n\n- Create `conf.d/.htaccess` to specify the username and password  \n  Or use Perl script, invoke multiple times for multiple users.\n\n```sh\necho \"\u003cusername\u003e:`perl -le 'print crypt(\\\"\u003cpassword\u003e\\\", \"salt-hash\")'`:comment\" \u003e\u003e nginx/conf.d/.htaccess\n```\n\n- Enable `auth-basic.conf` include in `conf.d/default.conf`\n- You can also create new location block that includes `auth-basic.conf`\n\nIts recommended to **enable HTTPS** with Basic Auth, otherwise the credentials will be sent in plaintext and vulnerable to sniffing.\n\n## References\n\n[h5bp/server-configs-nginx: Nginx HTTP server boilerplate configs](https://github.com/h5bp/server-configs-nginx)  \n[Cipherli.st - Strong Ciphers for Apache, nginx and Lighttpd](https://syslink.pl/cipherlist/)  \n[How To Set Up Nginx with HTTP/2 Support on Ubuntu 16.04 | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-16-04)  \n[HTTP 2.0 With Nginx | Servers for Hackers](https://serversforhackers.com/c/http-20-with-nginx)\n[NGINX Docs | Restricting Access with HTTP Basic Authentication](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleesei%2Fdocker-nginx-cors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleesei%2Fdocker-nginx-cors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleesei%2Fdocker-nginx-cors/lists"}