{"id":32477111,"url":"https://github.com/tyler36/caddy-demo","last_synced_at":"2026-02-23T12:56:22.894Z","repository":{"id":308855904,"uuid":"1034336949","full_name":"tyler36/caddy-demo","owner":"tyler36","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-08T08:25:39.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-26T22:52:07.588Z","etag":null,"topics":["https","localhost"],"latest_commit_sha":null,"homepage":"","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/tyler36.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,"zenodo":null}},"created_at":"2025-08-08T08:22:46.000Z","updated_at":"2025-08-08T08:26:34.000Z","dependencies_parsed_at":"2025-08-08T10:19:32.045Z","dependency_job_id":"f3b43c2a-11b0-4285-b794-3d89bbb060a8","html_url":"https://github.com/tyler36/caddy-demo","commit_stats":null,"previous_names":["tyler36/caddy-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tyler36/caddy-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler36%2Fcaddy-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler36%2Fcaddy-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler36%2Fcaddy-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler36%2Fcaddy-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyler36","download_url":"https://codeload.github.com/tyler36/caddy-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyler36%2Fcaddy-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29743654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["https","localhost"],"created_at":"2025-10-26T22:51:36.710Z","updated_at":"2026-02-23T12:56:22.889Z","avatar_url":"https://github.com/tyler36.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Caddy HTTPS Static Site Server\n\nThis project serves static files from the `./site` directory over HTTPS using Caddy web server in Docker.\n\n## Prerequisites\n\n- Docker and Docker Compose installed\n- A web browser for testing\n\n## Project Structure\n\n```tree\n.\n├── docker-compose.yml    # Docker Compose configuration\n├── Caddyfile            # Caddy web server configuration\n├── site/                # Static files directory\n│   └── index.html       # Your web content\n└── README.md           # This file\n```\n\n## Setup Instructions\n\n### 1. Clone or Create the Project\n\nEnsure you have the following files in your project directory:\n\n- `docker-compose.yml`\n- `Caddyfile`\n- `site/index.html` (or your static content)\n\n### 2. Start the Server\n\nRun the following command to start the Caddy server:\n\n```bash\ndocker compose up\n```\n\nOr to run in the background:\n\n```bash\ndocker compose up -d\n```\n\n### 3. Access Your Site\n\nOnce the container is running, you can access your site at:\n\n- **HTTPS**: \u003chttps://localhost\u003e\n- **HTTP**: \u003chttp://localhost\u003e (will redirect to HTTPS)\n\n## SSL Certificate Setup\n\nCaddy automatically generates a self-signed certificate for local development. Your browser will show a security warning the first time you visit.\n\n### Adding Certificate to Chrome (Optional)\n\nTo avoid browser warnings, you can add Caddy's root CA certificate to Chrome:\n\n1. Extract the certificate from the container:\n\n   ```bash\n   docker compose exec caddy cat /data/caddy/pki/authorities/local/root.crt \u003e caddy-root-ca.crt\n   ```\n\n2. Install in Chrome:\n   - Go to `chrome://settings/certificates`\n   - Click the **\"Authorities\"** tab\n   - Click **\"Import\"**\n   - Select the `caddy-root-ca.crt` file\n   - Check **\"Trust this certificate for identifying websites\"**\n   - Click **\"OK\"**\n\n3. Restart Chrome and visit \u003chttps://localhost\u003e\n\n## Configuration Files\n\n### docker-compose.yml\n\n```yaml\nservices:\n  caddy:\n    image: caddy:latest\n    ports:\n      - \"80:80\"\n      - \"443:443\"\n    volumes:\n      - ./site:/usr/share/caddy:ro\n      - ./Caddyfile:/etc/caddy/Caddyfile:ro\n```\n\n### Caddyfile\n\n```caddy\n# Serve static files from /usr/share/caddy (mapped from ./site)\nlocalhost {\n  root * /usr/share/caddy\n  file_server\n  tls internal\n}\n```\n\n## Common Commands\n\n### Start the server\n\n```bash\ndocker compose up\n```\n\n### Start in background\n\n```bash\ndocker compose up -d\n```\n\n### Stop the server\n\n```bash\ndocker compose down\n```\n\n### Restart the server (after config changes)\n\n```bash\ndocker compose restart\n```\n\n### View logs\n\n```bash\ndocker compose logs caddy\n```\n\n### Follow logs in real-time\n\n```bash\ndocker compose logs -f caddy\n```\n\n## Testing and Debugging\n\n### Basic Connectivity Test\n\nTest if the server is responding:\n\n```bash\n# Test HTTPS (ignore certificate warnings)\ncurl -k https://localhost\n\n# Test HTTP (should redirect to HTTPS)\ncurl -I http://localhost\n```\n\n### Check Container Status\n\nVerify the container is running:\n\n```bash\ndocker compose ps\n```\n\nExpected output:\n\n```\nNAME            IMAGE          COMMAND                  SERVICE   CREATED         STATUS          PORTS\ncaddy-caddy-1   caddy:latest   \"caddy run --config …\"   caddy     X minutes ago   Up X minutes    0.0.0.0:80-\u003e80/tcp, 0.0.0.0:443-\u003e443/tcp\n```\n\n### View Container Logs\n\nCheck for errors or issues:\n\n```bash\ndocker compose logs caddy\n```\n\nLook for:\n\n- ✅ `\"server running\"` messages\n- ✅ `\"certificate installed properly\"`\n- ❌ Any error messages or warnings\n\n### Test File Serving\n\nVerify specific files are being served:\n\n```bash\n# Test main page\ncurl -k https://localhost\n\n# Test specific file (if it exists)\ncurl -k https://localhost/style.css\n```\n\n### Common Issues and Solutions\n\n#### 1. \"Connection refused\" error\n\n- **Cause**: Container not running\n- **Solution**: Run `docker compose up`\n\n#### 2. \"Invalid response\" error\n\n- **Cause**: Wrong URL or port\n- **Solution**: Use `https://localhost` (not `https://localhost:443`)\n\n#### 3. Certificate warnings in browser\n\n- **Cause**: Self-signed certificate\n- **Solution**: Either ignore the warning or install the CA certificate (see SSL Certificate Setup)\n\n#### 4. Files not updating\n\n- **Cause**: Browser cache\n- **Solution**: Hard refresh (`Ctrl+F5` or `Cmd+Shift+R`)\n\n#### 5. Permission errors\n\n- **Cause**: File permissions on mounted volumes\n- **Solution**: Check that files in `./site` are readable:\n\n  ```bash\n  \\ls --color=auto -la site/\n  ```\n\n### Configuration Validation\n\nTest Caddyfile syntax without starting the server:\n\n```bash\ndocker run --rm -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile caddy:latest caddy validate --config /etc/caddy/Caddyfile\n```\n\n### Port Conflicts\n\nIf ports 80 or 443 are already in use:\n\n```bash\n# Check what's using the ports\nsudo netstat -tlnp | \\grep --color=auto ':80\\|:443'\n\n# Or use different ports in docker-compose.yml\nports:\n  - \"8080:80\"\n  - \"8443:443\"\n```\n\nThen access via: \u003chttps://localhost:8443\u003e\n\n## Development Tips\n\n1. **Auto-reload**: Caddy automatically serves new files added to the `./site` directory\n2. **Log monitoring**: Use `docker compose logs -f caddy` to watch for issues\n3. **Configuration changes**: Restart with `docker compose restart` after modifying `Caddyfile`\n4. **Clean start**: Use `docker compose down \u0026\u0026 docker compose up` for a fresh start\n\n## Stopping the Server\n\nTo stop the server:\n\n```bash\ndocker compose down\n```\n\nThis will stop and remove the container, but preserve your files and configuration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyler36%2Fcaddy-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyler36%2Fcaddy-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyler36%2Fcaddy-demo/lists"}