Skip to content

Add Example Web Server Configuration to Docker Compose for Static File Serving #9

@anlu85

Description

@anlu85

Summary

Provide optional example configuration and documentation for integrating a dedicated web server (such as Nginx or Caddy) into the Docker Compose setup to serve static files and proxy application requests.
Additionally, provide a reverse proxy configuration (with HTTPS termination) as an example for production deployments.

Motivation

While WhiteNoise is suitable for many deployments, using a dedicated web server is a best practice for larger-scale or production environments. Including example configurations for popular web servers and reverse proxy setups will make it easier for users to adopt these best practices when needed, while still allowing flexibility in the choice of web server.

Detailed Description

  • Add example service definitions for a dedicated web server (e.g., Nginx or Caddy) to the Docker Compose setup.
  • Provide example configuration files (such as nginx.conf or Caddyfile) for serving static files from the STATIC_ROOT directory and proxying dynamic requests to the Django application.
  • Provide example reverse proxy configuration (including HTTPS termination) for production deployments.
  • Update documentation to explain when and how to use these configurations as an alternative to WhiteNoise, and clarify that users may choose any web server that fits their needs.
  • Document the recommended production setup: Django app behind a reverse proxy with HTTPS, static files served by the webserver.

Possible Implementation

  • Add optional example web server services (such as Nginx or Caddy) to docker-compose.yml.
  • Include example configuration files in the repository.
  • Add example reverse proxy configuration for HTTPS termination.
  • Update deployment documentation with instructions for enabling and customizing these services, and mention that other web servers can be used as well.
  • Clearly document the difference between development (WhiteNoise, HTTP) and production (reverse proxy, HTTPS) setups.

Tasks

  • Add example service and configuration for a dedicated web server (e.g., Nginx or Caddy) in Docker Compose.
  • Add example reverse proxy configuration for HTTPS termination.
  • Update Docker Compose documentation with example usage.
  • Document when to use a dedicated web server vs. WhiteNoise, and clarify that the choice of web server is flexible.
  • Explain production deployment best practices (reverse proxy, HTTPS, static file serving).

Acceptance Criteria

  • Example web server configurations (such as Nginx or Caddy) are present in the repository.
  • Example reverse proxy configuration for HTTPS is available.
  • Docker Compose can be easily extended to use a dedicated web server and reverse proxy if desired.
  • Documentation clearly explains usage, trade-offs, and keeps the choice of web server open.
  • Production deployment best practices are documented.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions