nginx + uwsgi 配置参考
参考
http://www.runoob.com/django/django-nginx-uwsgi.html
####### 20181029
cd ~
wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
tar xvf Python-2.7.5.tar.bz2
cd Python-2.7.5
./configure --prefix=/usr/local
make && make altinstall
4,更改系统默认版本
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python2.7 /usr/bin/python
在完成了上面4步之后,如果有使用yum的话会发现出错,这是因为yum 依赖2.4.3而现在默认的 Python 版本是 2.7.3 。
vim /usr/bin/yum
将首行显示的 !#/usr/bin/python 修改为 !#/usr/bin/python2.4
### pip
cd ~
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
[root@pythontest ~]# python get-pip.py
Collecting pip
/tmp/tmpRRrzFV/pip.zip/pip/_vendor/urllib3/util/ssl_.py:369: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/tmp/tmpRRrzFV/pip.zip/pip/_vendor/urllib3/util/ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/tmp/tmpRRrzFV/pip.zip/pip/_vendor/urllib3/util/ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
51% |████████████████▍ | 675kB 42kB/s eta 0:00:1 51% |████████████████▋ | 686kB 42kB/s eta 0:00:1 52% |████████████████▉ | 696kB 41kB/s eta 0:00:1 53% |█████████████████ | 706kB 34kB/s eta 0:00:1 54% |█████████████████▎ | 716kB 42kB/s eta 0:00: 54% |█████████████████▋ | 727kB 36kB/s eta 0:00: 55% |█████████████████▉ | 737kB 36kB/s eta 0:00: 56% |██████████████████ | 747kB 35kB/s eta 0:00: 57% |██████████████████▎ | 757kB 37kB/s eta 0:00 58% |██████████████████▋ | 768kB 31kB/s eta 0:00 58% |██████████████████▉ | 778kB 37kB/s eta 0:00 59% |███████████████████ | 788kB 31kB/s eta 0:00 60% |███████████████████▎ | 798kB 35kB/s eta 0:0 61% |███████████████████▋ | 808kB 37kB/s eta 0:0 61% |███████████████████▉ | 819kB 34kB/s eta 0:0 62% |████████████████████ | 829kB 34kB/s eta 0:0 63% |████████████████████▎ | 839kB 29kB/s eta 0: 64% |████████████████████▌ | 849kB 31kB/s eta 0: 64% |████████████████████▉ | 860kB 32kB/s eta 0: 65% |█████████████████████ | 870kB 35kB/s eta 0: 66% |█████████████████████▎ | 880kB 35kB/s eta 0 67% |█████████████████████▌ | 890kB 39kB/s eta 0 68% |█████████████████████▉ | 901kB 35kB/s eta 0 68% |██████████████████████ | 911kB 40kB/s eta 0 69% |██████████████████████▎ | 921kB 41kB/s eta 70% |██████████████████████▌ | 931kB 48kB/s eta 71% |██████████████████████▊ | 942kB 58kB/s eta 71% |███████████████████████ | 952kB 49kB/s eta 72% |███████████████████████▎ | 962kB 54kB/s eta 73% |███████████████████████▌ | 972kB 55kB/s eta 74% |███████████████████████▊ | 983kB 66kB/s eta 75% |████████████████████████ | 993kB 70kB/s eta 75% |████████████████████████▎ | 1.0MB 75kB/s et 76% |████████████████████████▌ | 1.0MB 71kB/s et 77% |████████████████████████▊ | 1.0MB 67kB/s et 78% |█████████████████████████ | 1.0MB 54kB/s et 78% |█████████████████████████▎ | 1.0MB 61kB/s e 79% |█████████████████████████▌ | 1.1MB 75kB/s e 80% |█████████████████████████▊ | 1.1MB 76kB/s e 81% |██████████████████████████ | 1.1MB 82kB/s e 82% |██████████████████████████▎ | 1.1MB 65kB/s 82% |██████████████████████████▌ | 1.1MB 72kB/s 83% |██████████████████████████▊ | 1.1MB 78kB/s 84% |███████████████████████████ | 1.1MB 66kB/s 85% |███████████████████████████▎ | 1.1MB 79kB/s 85% |███████████████████████████▌ | 1.1MB 92kB/s 86% |███████████████████████████▊ | 1.1MB 73kB/s 87% |████████████████████████████ | 1.2MB 73kB/s 88% |████████████████████████████▎ | 1.2MB 57kB/ 88% |████████████████████████████▌ | 1.2MB 59kB/ 89% |████████████████████████████▊ | 1.2MB 65kB/ 90% |█████████████████████████████ | 1.2MB 50kB/ 91% |█████████████████████████████▏ | 1.2MB 51kB 92% |█████████████████████████████▌ | 1.2MB 51kB 92% |█████████████████████████████▊ | 1.2MB 42kB 93% |██████████████████████████████ | 1.2MB 47kB 94% |██████████████████████████████▏ | 1.2MB 46k 95% |██████████████████████████████▌ | 1.3MB 46k 95% |██████████████████████████████▊ | 1.3MB 50k 96% |███████████████████████████████ | 1.3MB 45k 97% |███████████████████████████████▏| 1.3MB 50 98% |███████████████████████████████▍| 1.3MB 58 99% |███████████████████████████████▊| 1.3MB 52 99% |████████████████████████████████| 1.3MB 58 100% |████████████████████████████████| 1.3MB 73kB/s
Collecting wheel
Downloading https://files.pythonhosted.org/packages/5a/9b/6aebe9e2636d35d1a93772fa644c828303e1d5d124e8a88f156f42ac4b87/wheel-0.32.2-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Successfully installed pip-18.1 wheel-0.32.2
/tmp/tmpRRrzFV/pip.zip/pip/_vendor/urllib3/util/ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
##########1030
http://www.runoob.com/django/django-nginx-uwsgi.html
https://www.cnblogs.com/Erick-L/p/7066455.html
https://www.aliyun.com/jiaocheng/518116.html
[root@pythontest conf]# [uWSGI] getting INI configuration from /etc/uwsgi9090.ini
[1]+ Done uwsgi --ini /etc/uwsgi9090.ini
[root@pythontest conf]# /usr/local/nginx/sbin/nginx
-bash: /usr/local/nginx/sbin/nginx: 没有那个文件或目录
[root@pythontest conf]# /usr/local/nginx-1.5.6/sbin/nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
##solution
cd /var/run
touch uwsgi9090.pid
chmod 777 uwsgi9090.pid
edit file
/usr/local/nginx-1.5.6/conf/nginx.conf
location / {
# root html;
# index index.html index.htm;
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_param UWSGI_SCRIPT demosite.wsgi;
uwsgi_param UWSGI_CHDIR /app/demosite;
index index.html index.htm;
client_max_body_size 35m;
}
edit file /etc/uwsgi9090.ini
[uwsgi]
socket = 127.0.0.1:9090
master = true //主进程
vhost = true //多站模式
no-site = true //多站模式时不设置入口模块和文件
workers = 2 //子进程数
reload-mercy = 10
vacuum = true //退出、重启时清理文件
max-requests = 1000
limit-as = 512
buffer-size = 30000
pidfile = /var/run/uwsgi9090.pid
daemonize = /website/uwsgi9090.log
pythonpath = /usr/local/lib/python2.7/site-packages
uwsgi --ini /etc/uwsgi9090.ini &
ps -ef|grep uwsgi
check log
tail -f /website/uwsgi9090.log
/usr/local/nginx-1.5.6/sbin/nginx
ps -ef|grep nginx
nginx + uwsgi 配置参考的更多相关文章
- 快速部署Python应用:Nginx+uWSGI配置详解
在PHP里,最方便的就是deployment了,只要把php文件丢到支持PHP的路径里面,然后访问那个路径就能使用了:无论给主机添加多少PHP应用,只要把目录改好就没你的事了,完全不用关心php-cg ...
- Nginx + uWSGI 配置django---终极版
好开森,配置了差不多一天的项目,终于成功了,写一篇博客庆祝一下 我们先来了解下nginx与uwsgi的概念,再去配置 磨刀不误砍柴工. nginx 是一个开源的高性能的 HTTP 服务器和反向代理:1 ...
- nginx+uwsgi配置
nginx #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; ...
- NGINX部署配置参考.
请求动态页面 1. uwsgi.ini配置文件.(主从负载uwsgi1.) 2. uwsgi2 的配置文件 3.查看. 4.结构图 5.配置 NGINX服务器 定义上游有哪些服务器. 定义转交给up ...
- 使用Nginx+uwsgi在亚马逊云服务器上部署python+django项目完整版(二)——部署配置及相关知识
---恢复内容开始--- 一.前提: 1.django项目文件已放置在云服务器上,配置好运行环境,可正常运行 2.云服务器可正常连接 二.相关知识 1.python manage.py runserv ...
- ubuntu配置Python-Django Nginx+uwsgi 安装配置
安装Nginx sudo apt-get install nginx ubantu安装完Nginx后,文件结构大致为: 所有的配置文件都在 /etc/nginx下: 启动程序文件在 /usr/sbin ...
- Nginx+uwsgi+Django 的web应用环境部署-完整记录
Python作为当前最火爆最热门,也是最主要的Web开发语言之一,在其二十多年的历史中出现了数十种Web框架,比如Django.Tornado.Flask.Twisted.Bottle和Web.py等 ...
- nginx location 配置详解 【转载,整理】
http://www.nginx.cn/115.html NGINX location 配置参考:http://www.cnblogs.com/zlingh/p/6288994.html https: ...
- Nginx+uWSGI+Django环境配置
通常项目会部署在虚拟环境,虚拟环境的使用可以参考这里,点击前往 当然你也可以直接部署,这里不多说. 一.安装uWSGI 1.通过pip安装 pip install uwsgi 这里只说明了一种安装方式 ...
随机推荐
- USB无线网卡导致耳机电流声很大
今天把许久未用的USB无线网卡插入到电脑中,戴上耳机准备听音乐,发现耳机里面的电流声非常大.回想以前并没有这种状况呀,忽然发现原来是USB无线网卡和耳机都插在前置面板中了,把USB无线网卡插在后置面板 ...
- python3-打印一个进度条
# Auther: Aaron Fan import sys,time for i in range(30): #打印一个#号,这种方法打印不会自动换行 sys.stdout.write('#') # ...
- LeetCode第21题:合并两个有序链表
题目描述: 将两个有序链表合并为一个新的有序链表并返回.新链表是通过拼接给定的两个链表的所有节点组成的. 示例: 输入:1->2->4, 1->3->4 输出:1->1- ...
- Bootstrap 的 ScrollSpy
一.简介 ScrollSpy 就是滚动监听.设置滚动监听方式有两种: 标签 API JavaScript 代码 监听区域也有两种可能: body 标签 自定义标签元素 {注意} ScrollSpy 需 ...
- C++笔记--指针数组和结构
指针 类型为T*的变量能保存一个类型T对象的地址 Char c=‘a’:Char * p=& c://保存了c的地址 指针的操作一般都是间接的引用,就是相当于引用指针所指的对象. 0是一个特殊 ...
- 使用JMeter的Java Sampler轻松定制自己的benchmark
做性能测试,接口测试,非常好 转自 http://www.iteye.com/topic/1123432 以前碰到更多的是WEB APP的性能测试,也许用得最多的是Loadrunner, Web S ...
- 《Linux内核设计与实现》读书笔记(九)- 内核同步介绍
存在共享资源(共享一个文件,一块内存等等)的时候,为了防止并发访问时共享资源的数据不一致,引入了同步机制. 主要内容: 同步的概念 同步的方法-加锁 死锁 锁的粒度 1. 同步的概念 了解同步之前,先 ...
- C#面向对象之三大特性: 封装
学到封装就会想到访问修饰符,说到访问修饰符,就会想到访问等级,或者说是访问能力的大小.当然也少不了默认的访问类型. C# 方法默认访问级别 : private (私有的) C# 类默认访问级别 : i ...
- No module named 'numpy.core._multiarray_umath'
问题:基于anaconda prompt 安装好TensorFlow框架以后,引入的时候(import tensorflow as tf)报如下图片的错误: 回答:网上好多人说是需要升级numpy,我 ...
- [51nod1239] 欧拉函数之和(杜教筛)
题面 传送门 题解 话说--就一个杜教筛--刚才那道拿过来改几行就行了-- //minamoto #include<bits/stdc++.h> #define R register #d ...