【发布时间】:2020-04-21 18:24:17
【问题描述】:
我已经用Nginx设置了一个代理,如下
server {
listen 80;
server_name localhost;
location /api {
proxy_pass https://api.mydomain.com/;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
我的 Dockerfile
FROM node:12-alpine as builder
WORKDIR /workspace
COPY ./package.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/www /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
这工作正常但想用 Traefik 替换 Nginx 以用于上述代理设置。任何帮助将不胜感激,因为我对 traefik 很陌生。
【问题讨论】:
-
对于 traefik,你在 Kubernetes 集群中使用它?你如何配置 Traefik?用静态文件?还是通过其他方式?
-
我在 Kubernetes 集群中使用它。
-
好的,现在是 traefik 1,7 或 2+ 版本(Traefik 在配置上在 2.0 版本中改变了很多东西)
-
它的traefik 2 +
标签: docker nginx proxy traefik