{"id":16225365,"url":"https://github.com/dimaslz/local-ssl-management-docker","last_synced_at":"2025-04-08T03:36:44.671Z","repository":{"id":175303337,"uuid":"653562297","full_name":"dimaslz/local-ssl-management-docker","owner":"dimaslz","description":"Command to run multiple domains with SSL without ports","archived":false,"fork":false,"pushed_at":"2023-06-14T14:32:50.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T02:46:56.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/dimaslz.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":"2023-06-14T09:39:11.000Z","updated_at":"2023-06-16T13:12:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e91109ca-e290-4b35-b949-fd80b2bce2e3","html_url":"https://github.com/dimaslz/local-ssl-management-docker","commit_stats":null,"previous_names":["dimaslz/local-ssl-management"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaslz%2Flocal-ssl-management-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaslz%2Flocal-ssl-management-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaslz%2Flocal-ssl-management-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimaslz%2Flocal-ssl-management-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimaslz","download_url":"https://codeload.github.com/dimaslz/local-ssl-management-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247772938,"owners_count":20993627,"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-10T12:44:50.369Z","updated_at":"2025-04-08T03:36:44.633Z","avatar_url":"https://github.com/dimaslz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local SSL management\n\nScript to manage local SSL certifications by [mkcert](https://github.com/FiloSottile/mkcert). The key of this script: do not use ports in the domain and use all of them through port 443.\n\n**Example**:\n\n`https://local.your-domain.tld:3000` → `https://local.your-domain.tld`\n\n\u003e ℹ️ At the moment, just tested in MacOS\n\n## Use case\n\nSometimes we need to use HTTPS for some security restrictions or just to work closely to the PRODUCTION reality.\n\nThis is not a common use case, just it is a particular scenario on my side. Probably you do not need this to work with multiple projects in local but, it is helpful for me, also maybe for you.\n\nSome of projects I work, has a authentication process linked to some platform like Github for example. Following this case, to setup your authentication process, you need to give a callback url like `https://local.your-domain.com:3000`, but sometimes I need to change the PORT for some reason. The problem is, I need to change the PORT in the service where I doing the authentication process and, all the parts in the code where I have the domain set, as for example, in the environment vars.\n\nNow, you can work without port when you use HTTPS, so, you can access to `https://local.your-domain.com` directly, without specify the PORT. With this script (`yarn cli`), back to the Github authentication case, just you need to give the domain, without care when you change teh PORT.\n\nYes, this is a specific use case but, for me sometimes is very useful and, I do not need to touch anything on my machine.\n\n### Others\n\n* When you need to do something related with different TLD, as for example: setup a default language according to the TLD. You do not need to add a special script to get the TLD.\n* ...\n\n## Requirements\n\n* Nodejs +16\n* Docker\n* Mkcert\n* Update /etc/hosts manually\n\n## TODO\n\n* [ ] Add certs manually\n* [ ] Add custom nginx config\n* [ ] CLI\n\n## How it works?\n\n![alt text](/architecture-schema.png)\n\nBasically, the script creates a container based on [Nginx](https://hub.docker.com/_/nginx), and this container works as proxy for local domains, like in a server.\n\n## How to use\n\n**#1 - Update your /hosts**:\n\nOSX:\n\n```bash\n...\n127.0.0.1\t\t\t\t\tlocal.your-domain.com\n```\n\n**#2 - Setup config**:\n\n```json\n[\n  {\n    \"domain\": \"local.your-domain.com\",\n    \"port\": 2000, // port where the application is running http://localhost:2000\n  },\n  ...\n]\n```\n\n**#3 - Run your application**:\n\nThe script will work but, if your application is not running, the domain with not resolve the source.\n\n**#4 - Run the script**:\n\nBefore all, build the script by running `yarn build` and after `yarn up`\n\nThe script will:\n\n* Check the `config.json` file, creating the new SSL certificates if needed.\n* Create the `nginx.conf` per each domain.\n* Generate the `Dockerfile` configuration.\n* Remove and create the new image (named `local-ssl-management`).\n* Remove and create the new container (named `local-ssl-management`).\n\n\u003e All files create will be into `.temp` folder.\n\n**#4 - Go to your domain and check it**:\n\nGo you your application local domain: [https://local.your-domain.com](https://local.your-domain.com) and... should work 😅.\n\n## Author\n\n```json\n{\n  \"name\": \"Dimas López Zurita\",\n  \"role\": \"Senior Software Engineer\",\n  \"alias\": \"dimaslz\",\n  \"linkedin\": \"https://www.linkedin.com/in/dimaslopezzurita\",\n  \"github\": \"https://github.com/dimaslz\",\n  \"twitter\": \"https://twitter.com/dimaslz\",\n  \"tags\": \"tooling, docker, tailwindcss, vue, SAAS, nodejs+express\"\n}\n```\n\n## My other projects\n\n* [https://ng-heroicons.dimaslz.dev/](https://ng-heroicons.dimaslz.dev/): An Angular components library to use Heroicons.com in your Angular projects.\n* [https://randomdata.loremapi.io/](https://randomdata.loremapi.io/): A tool to create mock Api responses with your custom schema.\n* [https://svg-icon-2-fw-component.dimaslz.dev](https://svg-icon-2-fw-component.dimaslz.dev): A tool to create a framework icon component from a SVG\n* [https://loremapi.io](https://loremapi.io): Mock and document your Api's\n* [https://cv.dimaslz.dev](https://cv.dimaslz.dev): My online CV\n* [https://api.dimaslz.dev](https://api.dimaslz.dev): My professional info by API\n* [https://dimaslz.dev](https://dimaslz.dev): Dev landing\n* [https://dimaslz.com](https://dimaslz.com): Profesional landing profile\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimaslz%2Flocal-ssl-management-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimaslz%2Flocal-ssl-management-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimaslz%2Flocal-ssl-management-docker/lists"}