Skip to content

Multiple containers on the same port, or hosting static content on the root nginx proxy? #326

@SuperRoach

Description

@SuperRoach

A common method of deploying a python django app is to use something like gunicorn to run the dynamic content, and it will then spit out a of static content (think css and js files) that the client would need.

This would mean you would have a container serving your dynamic content and being proxied through xyz.com great. But how would you host the static content on the same domain, albeit in a different location? (under /static/)?

  • Create a second static container, with a basic nginx config that hosts the local content, on the same VIRTUAL_HOST. When I do this, the nginx proxy is alternating between which container gets the request.

  • Somehow alter the main nginx-proxy to have a location entry in the nginx config, in order to serve the content itself, or point to a docker container if a request is in /static/ .
    That would look some thing like this, next to it's / entry.
    location /static/ { root /some/place/on/nginx-proxy/static/; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions