小编Kwi*_*ies的帖子

如何将多台主机从 traefik 2 定向到一台 nginx

我想使用 traefik 2 将 test1.test 和 test2.test 路由到 nginx php 配置中的不同文件夹。两者都是 PHP 应用程序。

这是我的 nginx site.conf:

server {
    listen 80;

    server_name test1.test
    root /var/www/html/test1;
}
server {
    listen 80;

    server_name test2.test
    root /var/www/html/test2;
}
Run Code Online (Sandbox Code Playgroud)

这是 traefik 容器的 mij docker-compose 文件

version: "3"

services:
  traefik:
    image: "traefik:v2.3"
    container_name: "traefik"
    restart: "unless-stopped"
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
      - ./traefik.toml:/traefik.toml:ro
      - ./acme.json:/acme.json
      - ./configurations:/configurations
networks:
  proxy:
    external: true
  internal:
    external: false
Run Code Online (Sandbox Code Playgroud)

以及我的应用程序的 …

php drupal nginx docker traefik

3
推荐指数
1
解决办法
8984
查看次数

标签 统计

docker ×1

drupal ×1

nginx ×1

php ×1

traefik ×1