nginx配置django

by Admin


Posted on 2026-02-12 08:00   Views: 4


    location / {
      proxy_pass http://localhost:8000; #django 服务
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }

 

    location ^~ /static/ {
      alias /xxx/xxx/staticfiles/; #静态资源路径      
    }
    
    location ^~ /media/ {
      alias /xxx/xxx/media/; #静态资源路径      
    }


搜索
分类
关于本文
本文发布于 2026-02-12,最后更新于 2026-02-12。