资讯详情

centos7+django+uwsgi+nginx访问报错-问答-阿里云开发者社区-阿里云

报错如下:

2016/05/13 19:02:40 [error] 11057#0: *162 upstream prematurely closed connection while reading

response header from upstream, client: xxx.xxx.xxx.xxx, server: xxx.xxx.xxx.xxx, request: "GET

/poweredby.png HTTP/1.1", upstream: "uwsgi://127.0.0.1:8003", host: "xxx.xxx.xxx.xxx:8000",

referrer: "http://xxx.xxx.xxx.xxx:8000/"

uwsgi 配置如下:

[uwsgi]

socket = 127.0.0.1:8003

touch-reload=/myblog/reload

processes = 2

threads = 4

vacuum = true

nginx 配置如下:

server {

listen 8000;

server_name xxx.xxx.xxx.xxx;

root /usr/share/nginx/html;

access_log /logs/access.log;

error_log /logs/error.log;

charset utf-8;

# Load configuration files for the default server block.

location / {

include /etc/nginx/uwsgi_params;

uwsgi_pass 127.0.0.1:8003;

client_max_body_size 35m;

uwsgi_param UWSGI_SCRIPT myblog.wsgi;

uwsgi_param UWSGI_CHDIR /myblog;

}

location /media {

alias /path/to/project/media;

}

location /static {

alias /path/to/project/static;

}

error_page 404 /404.html;

location = /40x.html {

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

}

}

views.py 文件内容

#coding:utf-8

from django.shortcuts import render

from django.http import HttpResponse

# Create your views here.

def index(request):

return HttpResponse(u"Hello World!!")

过了一天,死活连不上, uwsgi8003 正常访问端口, nginx 代理 8000 端口无法连接,端口已打开,防火墙已关闭,求解,感谢!

标签: powere继电器

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台