我有2个dockers容器正在运行。 Nginx和NodeJS Express编写的静态角度Web应用程序。 Web应用程序和Express服务器都运行良好。但是,当我调用POST请求时,快递服务器返回 502:网关错误
列表项
(网络应用)Nginx.conf
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}
(网络应用)Docker
FROM nginx:alpine
RUN rm /usr/share/nginx/html/*
COPY ./dist /usr/share/nginx/html
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx"]
(Express App)Dockerfile
FROM node:10-alpine
# Create app directory
WORKDIR /app
COPY . .
EXPOSE 6644
CMD ["npm", "start"]
运行网络应用程序容器
docker container run -d webapp --network="traefik_proxy" -p 8888:80
--label "traefik.backend=shijieadmin-production"
--label "traefik.frontend.rule=Host:web.domain.com"
--label "traefik.enable=true"
--label "traefik.port=80"
--label "traefik.docker.network=traefik_proxy"
运行Express应用程序容器
docker container run -d expressapp --network="traefik_proxy" -p 6644:6644
--label "traefik.frontend.rule=Host:api.domain.com"
--label "traefik.enable=true"
--label "traefik.port=6644"
--label "traefik.docker.network=traefik_proxy"