安装这里就不多说,直接配置问题及所遇到问题总结
django 项目 manage.py目录新建uwsgi.ini文件
uwsgi配置
[uwsgi]
请求方式与端口号
socket = 127.0.0.1:9000 # uwsgi直接访问用http,nginx访问用socket
http= 127.0.0.1:9000
chdir = /usr/local/www/项目目录
wsgi-file = /usr/local/www/项目目录/项目目录/wsgi.py
module = 项目目录.wsgi
buffer-size = 65536
callable=app
master = true
processes = 4
threads=2
master =True
vacuum = true
pidfire= uwsgi.pid
plugins = python36
logto = /usr/local/www/项目目录/logs/uwsgi.log
nginx配置
server {
listen 8001 default_server;
server_name 127.0.0.1;
access_log /usr/local/www/项目目录/logs/access.log;
error_log /usr/local/www/项目目录/logs/error.log;
location / {
include /usr/local/nginx/conf/uwsgi_params;
uwsgi_pass 127.0.0.1:9099; #必须和uwsgi中的设置一致
}
}
遇到错误:
1、Internal Server Error
出现这种错没有配置wsgi.py
wsgi-file = /usr/local/www/项目目录/项目目录/wsgi.py
这个文件类似于入口文件,命令创建django会自动创建
2、502错误
查看uwsgi日志,502大部分uwsgi问题或者nginx等问题
tail -f /usr/local/www/项目目录/logs/uwsgi.log
– unavailable modifier requested: 0 –
– unavailable modifier requested: 0 –
这个是需要安装uwsgi-plugin-python
yum install uwsgi-plugin-python
然后uwsgi.ini文件添加配置
plugins = python 此处注意:plugins = python36 我配置的是python36,之前直接写python3会报错:
/usr/lib/uwsgi/plugins/python_plugin.so: cannot open shared object file: No such file or directory
ll /usr/lib64/uwsgi/文章来源:https://www.toymoban.com/news/detail-810393.html
总用量 476
-rwxr-xr-x. 1 xxx cgi_plugin.so
-rwxr-xr-x. 1 xxx http_plugin.so
-rwxr-xr-x. 1 xxx python36_plugin.so
-rwxr-xr-x. 1 xxx python_plugin.so文章来源地址https://www.toymoban.com/news/detail-810393.html
到了这里,关于linux centos7 django uwsgi 部署的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!