我有一个简单的wordpress docker-compose设置,可以在我的主域上运行,并且定义如下:
v-list-group
当我尝试访问blog.example.com但将前端规则更改为
时,我在浏览器中收到一条ERR_NAME_NOT_RESOLVED消息version: '3.2'
services:
reverse-proxy:
image: traefik # The official Traefik docker image
command: --api --docker # Enables the web UI and tells Traefik to listen to docker
ports:
- "443:443"
- "80:80" # The HTTP port
- "8080:8080" # The Web UI (enabled by --api)
volumes:
- /etc/traefik/traefik.toml:/traefik.toml
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik
networks:
- internal
- test_network
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- internal
- test_network
wordpress:
ports:
- "8001:8001"
depends_on:
- db
image: wordpress:latest
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
labels:
- "traefik.frontend.rule=Host:blog.example.com"
networks:
- internal
- test_network
volumes:
db_data: {}
networks:
test_network:
external: true
internal:
external: false
它按我的预期工作。我在做什么错了?
/etc/traefik/traefik.toml中目前没有任何内容,并且该文件目前不存在。
答案 0 :(得分:1)
原来,我必须在我的注册商/网络主机上配置子域。更新A记录后,它便开始工作。