How to manually add site conf's for proxy_pass (127.0.0.1) in docker rootless #2339
-
I have decided to migrate my Mastodon docker to rootless. I have created to users that run in separate namespaces. The first stack is Mastodon (5 services): services:
web:
ports:
- "127.0.0.1:3000:3000"
environment:
# VIRTUAL_HOST: "mastodon.mytld.com"
# VIRTUAL_PATH: "/"
# VIRTUAL_PORT: 3000
# LETSENCRYPT_HOST: "mastodon.mytld.com"
# LETSENCRYPT_EMAIL: "mail@mytld.com"
streaming:
ports:
- "127.0.0.1:4000:4000"
environment:
# VIRTUAL_HOST: "mastodon.mytld.com"
# VIRTUAL_PATH: "/api/v1/streaming"
# VIRTUAL_PORT: 4000
[...] The nginx-stack: version: "3.7"
services:
reverse-proxy:
image: jwilder/nginx-proxy:latest
container_name: reverse-proxy
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
volumes:
- /srv/nginx/data/certs:/etc/nginx/certs:ro
- /srv/nginx/data/config/dhparam:/etc/nginx/dhparam
- /srv/nginx/data/config/html:/usr/share/nginx/html
- /srv/nginx/data/config/vhost.d:/etc/nginx/vhost.d
- /srv/nginx/data/config/conf.d:/etc/nginx/conf.d
- /srv/nginx/data/logs:/var/log/nginx
- ${XDG_RUNTIME_DIR}/docker.sock:/tmp/docker.sock:ro
environment:
- SSL_POLICY=Mozilla-Modern
- ENABLE_IPV6=true
- TRUST_DOWNSTREAM_PROXY=false
restart: always
networks:
- net
letsencrypt:
image: nginxproxy/acme-companion
container_name: letsencrypt-helper
volumes_from:
- reverse-proxy
volumes:
- /srv/nginx/data/certs:/etc/nginx/certs:rw
- /srv/nginx/data/acme:/etc/acme.sh
- ${XDG_RUNTIME_DIR}/docker.sock:/var/run/docker.sock:ro
environment:
DEFAULT_EMAIL: "mail@mytld.com"
restart: always
networks:
- net
networks:
net:
external: true I wanted to separate nginx and my service stack because I will be adding more docker services and I don't want all to run in the same userspace. This means I will have to proxy through port bindings on localhost. The services as stated above run fine, no errors, server is reachable on localhost via However, in this case all commented environment parameters are useless ( What would be the simplest way to reach the same effect by manually modifying/adding these to the nginx stack? I tried creating a file at:
with the following content (according to the Readme): location / {
proxy_pass http://127.0.0.1:3000;
} But it does not seem to have any effect. I don't want to create my own I don't see any other users having this problem, which is strange since docker rootless gained traction. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi. Could you elaborate on what you mean by
Why are those environment variables commented out in your Mastodon compose files ? On which network are those containers, the default one created with the compose file (won't work) or |
Beta Was this translation helpful? Give feedback.
I might be missing something here but why don't you connect the Matsodon containers to the
net
network ? Having the proxy and the proxyed containers sharing at least one network is one of the basic requirements for usage of nginx-proxy.