centos7下安装uwsgi出现的问题

正常情况下使用pip3 安装的uwsgi
使用 uwsgi --http :8001 --wsgi-file test.py
curl 8001端口时 却出现 Internal Server Error
于是查看官网:https://uwsgi-docs.readthedocs.io/en/latest/Install.html#installing-from-source

On a Fedora/Redhat system you can install them with:

yum groupinstall "Development Tools"
yum install python

For python/wsgi support:

yum install python-devel

经过一番折腾
安装了uwsgi最新版本,老版本是不支持python3的
假设我们的Django项目名为"myproject",里面有一个应用叫"myapp"
在你的django项目下新建 myproject.xml,内容如下:


    127.0.0.1:8001
        /home/www/myproject
            myproject.wsgi
                32  
    uwsgi.log

```:
接着,在nginx.conf中增加一个server配置

server {
listen 8000; #暴露给外部访问的端口
server_name localhost;
charset utf-8;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8001; #外部访问8000就转发到内部8001
}
# …再配置些静态文件之类的
}

最后解析刚刚创建的xml
uwsgi -x myproject.xml
提示

[uWSGI] parsing config file myproject.xml

最后重启nginx 即可正常访问
更多参考

Nginx+uWSGI+Supervisor在Ubuntu上部署Flask应用  http://www.linuxidc.com/Linux/2016-07/133064.htm

uWSGI+Django+Nginx的工作原理流程与部署过程 http://www.linuxidc.com/Linux/2017-03/141785.htm

快速部署Python应用:Nginx+uWSGI配置详解  http://www.linuxidc.com/Linux/2016-12/137830.htm

Nginx+uWSGI+Django+Python 应用架构部署  http://www.linuxidc.com/Linux/2015-10/124183.htm

Ubuntu Server 14.04.2 LTS 配置 Nginx + Uwsgi + Django  http://www.linuxidc.com/Linux/2015-04/116397.htm

Flask+uWSGI+Nginx+Ubuntu部署教程 http://www.linuxidc.com/Linux/2016-06/132690.htm

Ubuntu 16.04下安装部署 Nginx+uWSGI+Django1.9.7  http://www.linuxidc.com/Linux/2016-07/133484.htm

Nginx+uWSGI+Django在Ubuntu下的部署  http://www.linuxidc.com/Linux/2016-07/133490.htm

uWSGI+Nginx+Django安装和配置  http://www.linuxidc.com/Linux/2017-03/141822.htm

Linux 上利用Nginx代理uWSGI处理Flask Web应用  http://www.linuxidc.com/Linux/2016-08/134164.htm

Ubuntu 16.10 下部署Django+uWSGI+Nginx服务器:http://www.linuxidc.com/Linux/2017-05/143661.htm



UWSGI 报错:
Listen queue size is greater than the system max net.core.somaxconn (128).
解决办法:
这两个文件:
/proc/sys/net/ipv4/tcp_max_syn_backlog
 /proc/sys/net/core/somaxconn
vi 修改报错
直接:sudo echo 262144 > /proc/sys/net/core/somaxconn
 
 


你可能感兴趣的:(web部署)