V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
aljun
V2EX  ›  问与答

django 配置 uwsgi 和 nginx 时出现 socket 问题

  •  
  •   aljun · 2015-07-27 10:17:48 +08:00 · 2188 次点击
    这是一个创建于 3167 天前的主题,其中的信息可能已经有所发展或是发生改变。

    文件:

    blogtest_nginx.conf

    the upstream component nginx needs to connect to

    upstream django {

    server unix:///home/aljun/djangotest/blogtest/blogtest.sock; # for a file socket

    server 127.0.0.1:8000; # for a web port socket (we'll use this first)
    }

    configuration of the server

    server {

    the port your site will be served on

    listen 8000;

    the domain name it will serve for

    server_name .example.com; # substitute your machine's IP address or FQDN
    charset utf-8;

    max upload size

    client_max_body_size 75M; # adjust to taste

    Django media

    location /media {
    alias /home/aljun/djangotest/blogtest/media; # your Django project's media files - amend as required
    }

    location /static {
    alias /home/aljun/djangotest/blogtest/statices; # your Django project's static files - amend as required
    }

    Finally, send all non-media requests to the Django server.

    location / {
    uwsgi_pass django;
    include /home/aljun/djangotest/blogtest/uwsgi_params; # the uwsgi_params file you installed
    }
    }

    当我执行:

    uwsgi --socket :8001 --wsgi-file test.py
    得到的却是400 badrequest

    但是我的nginx跑起来了,http://localhost:8000/static/github1.css是有反应的

    terminal的报错是

    invalid request block size: 21573 (max 4096)...skip
    求大神帮解答

    而且这之前用http就没事,而用了socket就出问题了
    我之前是server 127.0.0.1.8001,也是400,才改成的8000的,测试uwsgi过了,用http而不是socket时是可一运行test.py的

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5947 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 02:08 · PVG 10:08 · LAX 19:08 · JFK 22:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.