【发布时间】:2018-11-27 02:20:07
【问题描述】:
我使用 docker compose 配置了我的 django-uwsgi-nginx 和以下文件。
从浏览器“http://127.0.0.1:8000/”工作正常,并为我提供 django 默认页面
从浏览器“http://127.0.0.1:80”抛出 502 Bad Gateway
dravoka-docker.conf
upstream web {
server 0.0.0.0:8000;
}
server {
listen 80;
server_name web;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
alias "/dravoka-static/";
}
location / {
include uwsgi_params;
proxy_pass http://web;
}
}
nginx/Dockerfile
FROM nginx:latest
RUN echo "---------------------- I AM NGINX --------------------------"
RUN rm /etc/nginx/conf.d/default.conf
ADD sites-enabled/ /etc/nginx/conf.d
RUN nginx -t
web 只是来自“django-admin startproject web”
docker-compose.yaml
version: '3'
services:
nginx:
restart: always
build: ./nginx/
depends_on:
- web
ports:
- "80:80"
web:
build: .
image: dravoka-image
ports:
- "8000:8000"
volumes:
- .:/dravoka
command: uwsgi /dravoka/web/dravoka.ini
Dockerfile
# Ubuntu base image
FROM ubuntu:latest
# Some installs........
EXPOSE 80
【问题讨论】:
-
终端> nginx_1 | 2018/06/18 11:18:29 [error] 7#7: *1 connect() failed (111: Connection refused) while connection to upstream, client: 172.23.0.1, server: web, request: "GET / HTTP /1.1”,上游:“0.0.0.0:8000”,主机:“127.0.0.1”
标签: docker nginx docker-compose uwsgi