Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django Nginx重定向到https://web_Django_Docker_Nginx_Docker Compose_Gunicorn - Fatal编程技术网

Django Nginx重定向到https://web

Django Nginx重定向到https://web,django,docker,nginx,docker-compose,gunicorn,Django,Docker,Nginx,Docker Compose,Gunicorn,直到今天,我的域名停止工作,我的webapp才开始正常工作。我曾使用example.com:8000/访问我的Django应用程序,但现在它将我重定向到。我试图回到以前的承诺,但问题并没有消失 我的nginx.conf看起来像: upstream web { ip_hash; server web:8000; } # portal server { location /static/ { autoindex on; alias /stati

直到今天,我的域名停止工作,我的webapp才开始正常工作。我曾使用example.com:8000/访问我的Django应用程序,但现在它将我重定向到。我试图回到以前的承诺,但问题并没有消失

我的nginx.conf看起来像:

upstream web {
  ip_hash;
  server web:8000;
}

# portal
server {

  location /static/ {
          autoindex on;
          alias /static/;
      }
  location / {
        proxy_pass http://web/;
    }
  listen 8000;
  server_name localhost;
}
docker-compose.yaml看起来像:

version: '3'

services:
  nginx:
    image: nginx:latest
    container_name: ng01
    ports:
      - "8000:8000"
    volumes:
      - ./code:/code
      - ./code/nginx:/etc/nginx/conf.d
      - ./static:/static
    depends_on:
      - web
  web:
    build: .
    container_name: dg01
    command: bash -c "python manage.py makemigrations && python manage.py migrate && gunicorn fortex.wsgi -b 0.0.0.0:8000"
    volumes:
      - .:/code
      - ./static:/static
    expose:
      - "8000"
    depends_on:
      - db
  db:
    image: postgres
    container_name: ps01
    volumes:
      - pg_volume:/var/lib/postgresql/data

volumes:
  pg_volume: {}

Nginx在不记录日志的情况下重定向,但当我在chrome中使用incognito时,它会正常记录日志,但仍会重定向我。

如果是301重定向,则可能会缓存在浏览器的缓存中,因此请尝试其他浏览器,看看它是否重定向。与firefox一起使用,谢谢!