{"id":25497468,"url":"https://github.com/perpetue237/docker-compose-secure-app","last_synced_at":"2026-04-12T10:44:34.747Z","repository":{"id":251052986,"uuid":"835634042","full_name":"Perpetue237/docker-compose-secure-app","owner":"Perpetue237","description":"A Docker Compose setup for securely serving applications with Nginx, featuring HTTPS (TLS) and basic authentication. This project includes configuration for SSL/TLS certificates and user authentication to ensure your application is protected and accessible only to authorized users.","archived":false,"fork":false,"pushed_at":"2024-08-26T14:15:30.000Z","size":286,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-26T20:22:23.970Z","etag":null,"topics":["authentication","docker","docker-compose","fastapi","nginx","nginx-docker","python","tls-certificate"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Perpetue237.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":"2024-07-30T08:24:19.000Z","updated_at":"2024-08-26T14:14:02.000Z","dependencies_parsed_at":"2024-07-31T16:44:10.001Z","dependency_job_id":"5ea28517-15e0-43a7-8fa4-18bc5b29c006","html_url":"https://github.com/Perpetue237/docker-compose-secure-app","commit_stats":null,"previous_names":["perpetue237/docker-compose-secure-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perpetue237%2Fdocker-compose-secure-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perpetue237%2Fdocker-compose-secure-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perpetue237%2Fdocker-compose-secure-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perpetue237%2Fdocker-compose-secure-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Perpetue237","download_url":"https://codeload.github.com/Perpetue237/docker-compose-secure-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239576745,"owners_count":19662114,"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":["authentication","docker","docker-compose","fastapi","nginx","nginx-docker","python","tls-certificate"],"created_at":"2025-02-19T01:20:07.011Z","updated_at":"2025-11-10T04:30:18.553Z","avatar_url":"https://github.com/Perpetue237.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker compose secure application with TLS and authentication\n\nA Docker Compose setup for securely serving applications using Nginx with HTTPS (TLS) and basic authentication. This project configures SSL/TLS certificates and user authentication to protect and restrict access to your application.\n- [docker compose secure application with TLS and authentication](#docker-compose-secure-application-with-tls-and-authentication)\n  - [Project Structure](#project-structure)\n  - [Setup Instructions](#setup-instructions)\n    - [Generate SSL Certificates](#generate-ssl-certificates)\n    - [Install `htpasswd` Utility](#install-htpasswd-utility)\n    - [Create the `.htpasswd` File and user1](#create-the-htpasswd-file-and-user1)\n  - [Build and Run the Docker Compose Setup](#build-and-run-the-docker-compose-setup)\n  - [Verify the Setup](#verify-the-setup)\n  - [Stop the Application and Clean the System](#stop-the-application-and-clean-the-system)\n  - [License](#license)\n  - [Contact](#contact)\n\n\n## Project Structure\n\n```plaintext\n├── app\n│   ├── Dockerfile\n│   ├── main.py\n│   └── requirements.txt\n├── auth            # .htpasswd for user authentication (not in Git)\n├── certs           #  SSL/TLS certificates (not in Git)\n│   ├── server.crt\n│   ├── server.csr\n│   └── server.key\n├── docker-compose.yml\n├── LICENSE\n├── nginx\n│   ├── Dockerfile\n│   └── nginx.conf\n└── README.md\n```\n\n## Setup Instructions\n### Generate SSL Certificates\n\n```sh\n\nopenssl genrsa -out certs/server.key 2048\nopenssl req -new -key certs/server.key -out certs/server.csr\nopenssl x509 -req -days 365 -in certs/server.csr -signkey certs/server.key -out certs/server.crt\n```\n\n### Install `htpasswd` Utility\n\n```sh\nsudo apt-get install apache2-utils\n```\n\n### Create the `.htpasswd` File and user1\n\n\u003e**Note:** Remember the password you set for `user1` in the `.htpasswd` file. You will need this password to access the secured area of the application.\n\n```sh\nmkdir -p ./auth\nhtpasswd -c ./auth/.htpasswd user1\n```\n\n## Build and Run the Docker Compose Setup\n\n\n```sh\ndocker-compose up --build -d\n```\n\n## Verify the Setup\n\nVisit [https://localhost:8443](https://localhost:8443) and login with the username(`user1`) and password you created before.\n\n\n\n\u003e**Note:** \n\u003e- The auth and certs directories are included in .gitignore for security reasons.\n\u003e- Ensure that ports 8080 and 8443 are available on your host machine.\n\u003e- The browser may show a warning that the connection is not secure. This is because a self-signed certificate is used for HTTPS. For production, you should obtain a certificate from a trusted Certificate Authority (CA) and configure it for your specific domain to avoid such warnings and ensure a secure connection.\n\n## Stop the Application and Clean the System\n\n```sh\ndocker-compose down\ndocker system prune\ndocker volume prune\n```\n## License\n\nDistributed under the Apache License. See [LICENSE](LICENSE) for more information.\n\n## Contact\n\n[Perpetue Kuete Tiayo](https://www.linkedin.com/in/perpetue-k-375306185)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperpetue237%2Fdocker-compose-secure-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperpetue237%2Fdocker-compose-secure-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperpetue237%2Fdocker-compose-secure-app/lists"}