Ubuntu Nginx uwsgi django 初试
/**************************************************************************************
* Ubuntu Nginx uwsgi django 初试
* 说明:
* 最近打算通过Python搭建一个数据收集的网站,先做一个搭建测试。
*
* 2016-8-5 深圳 南山平山村 曾剑锋
*************************************************************************************/ 一、参考文章:
. Ubuntu下搭建Nginx+Uwsgi+Python+Mysql开发环境
http://blog.csdn.net/hchuchuan/article/details/49718521
. 基于nginx和uWSGI在Ubuntu上部署Django
http://www.jianshu.com/p/e6ff4a28ab5a
. Install uwsgi 1.2. via pip
http://askubuntu.com/questions/182313/install-uwsgi-1-2-5-via-pip
. How To Install the Django Web Framework on Ubuntu 14.04
https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-14-04
. Nginx+uWSGI 入门
http://my.oschina.net/u/877567/blog/201577 二、Django目录结构:
zengjf@zengjf:~/website$ pwd
/home/zengjf/website
zengjf@zengjf:~/website$ tree
.
└── mysite
├── manage.py
└── mysite
├── __init__.py
├── __init__.pyc
├── settings.py
├── settings.pyc
├── urls.py
├── urls.pyc
└── wsgi.py directories, files
zengjf@zengjf:~/website$ 三、nginx配置:
root@zengjf:/etc/nginx/sites-available# pwd
/etc/nginx/sites-available
root@zengjf:/etc/nginx/sites-available# cat default
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file ##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
## server {
listen default_server;
listen [::]: default_server ipv6only=on; root /home/zengjf/website/mysite;
index index.html index.htm; # Make site accessible from http://localhost/
server_name localhost; location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a .
# try_files $uri $uri/ =;
include uwsgi_params;
uwsgi_pass 127.0.0.1:; #必须和uwsgi中的设置一致
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
} # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#} #error_page /.html; # redirect server error pages to the static page /50x.html
#
#error_page /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_index index.php;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen somename:;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ =;
# }
#} # HTTPS server
#
#server {
# listen ;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1 TLSv1. TLSv1.;
# ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ =;
# }
#}
root@zengjf:/etc/nginx/sites-available# 四、运行uwsgi命令:
root@zengjf:/home/zengjf/website# uwsgi --socket 127.0.0.1: --chdir /home/zengjf/website/mysite --wsgi-file mysite/wsgi.py --master --processes --threads
*** Starting uWSGI 2.0.13.1 (64bit) on [Fri Aug :: ] ***
compiled with version: 4.8. on August ::
os: Linux-3.16.--generic #~14.04.-Ubuntu SMP Thu Jan :: UTC
nodename: zengjf
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores:
current working directory: /home/zengjf/website
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /home/zengjf/website/mysite
your processes number limit is
your memory page size is bytes
detected max file descriptor number:
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket bound to TCP address 127.0.0.1: fd
Python version: 2.7. (default, Jun , ::) [GCC 4.8.]
Python main interpreter initialized at 0x24ae640
python threads support enabled
your server socket listen backlog is limited to connections
your mercy for graceful operations on workers is seconds
mapped bytes ( KB) for cores
*** Operational MODE: preforking+threaded ***
WSGI app (mountpoint='') ready in seconds on interpreter 0x24ae640 pid: (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: )
spawned uWSGI worker (pid: , cores: )
spawned uWSGI worker (pid: , cores: )

Ubuntu Nginx uwsgi django 初试的更多相关文章
- [技术博客]ubuntu+nginx+uwsgi+Django+https的部署
ubuntu+nginx+uwsgi+Django+https部署文档 配置机器介绍 操作系统:Ubuntu 18.04.2 LTS 64位 python版本:Python 3.6.7 Django版 ...
- ubuntu+nginx+uwsgi部署django web项目
前言 将本地开发的django项目部署至linux上的uwsgi服务器,并配置nginx,完成基于ubuntu+nginx+uwsgi的上线运行.下面整理相关步骤. 服务器配置virtualenv 如 ...
- ubuntu NGINX uwsgi https 部署Django 遇到的问题
搞了3天终于把Django成功部署到Ubuntu,记录一下: 引用来自泡泡茶壶: Ubuntu下的Nginx + Uwsgi + Django项目部署详细流程 前提说明: Django作为小程序的后端 ...
- 五步教你实现使用Nginx+uWSGI+Django方法部署Django程序
Django的部署可以有很多方式,采用nginx+uwsgi的方式是其中比较常见的一种方式. 在这种方式中,我们的通常做法是,将nginx作为服务器最前端,它将接收WEB的所有请求,统一管理请求.ng ...
- Nginx+uWSGI+Django+Python+ MySQL 搭建可靠的Python Web服务器
一.安装所需工具 yum -y install gcc gcc-c++ rpm-build mysql* libtool-ltdl* libtool automake autoconf libtool ...
- 安装Nginx+uWSGI+Django环境
Ubuntu Server 12.04 安装Nginx+uWSGI+Django环境 今天要介绍的是利用APT源直接apt-get install安装配置我们所需要的环境,首先按惯例先安装MySQL和 ...
- nginx+Uwsgi+Django总结与分析
配置与调试nginx与uwsgi 參考: 1.uWSGI其三:uWSGI搭配Nginx使用 2.学习VirtualEnv和Nginx+uwsgi用于django项目部署 3.部署备忘 4.nginx+ ...
- 转载nginx+uwsgi+django
Django的部署可以有很多方式,采用nginx+uwsgi的方式是其中比较常见的一种方式. 在这种方式中,我们的通常做法是,将nginx作为服务器最前端,它将接收WEB的所有请求,统一管理请求.ng ...
- nginx+uwsgi+django部署流程
当我们在用django开发的web项目时,开发测试过程中用到的是django自带的测试服务器,由于其安全及稳定等性能方面的局限性,django官方并不建议将测试服务器用在实际生产. nginx+uws ...
随机推荐
- [luoguP1186] 玛丽卡(spfa)
传送门 因为要随机删除一条边,而枚举所有边肯定会超时,经过发现,先求出一遍最短路,而要删除的边肯定在最短路径上,删除其他的边对最短路没有影响. 所以可以先求出最短路,再枚举删除最短路上的每一条边再求最 ...
- 【思维】2017多校训练七 HDU6121 Build a tree
http://acm.hdu.edu.cn/showproblem.php?pid=6121 [题意] 询问n个结点的完全k叉树,所有子树结点个数的异或和是多少 [思路] 一棵完全K叉树,对于树的每一 ...
- Java SSH框架系列:用户登录模块的设计与实现思路
1.简介用户登录模块,指的是根据用户输入的用户名和密码,对用户的身份进行验证等.如果用户没有登录,用户就无法访问其他的一些jsp页面,甚至是action都不能访问.二.简单设计及实现本程序是基于Jav ...
- vs code 使用心得
Jetbrains 家族的软件适合java,python开发,但是对与rust,shell等的开发,则显得有些臃肿,需要一款轻快的编辑器,经过挑选,在sublime3 与 vs code 中选则了vs ...
- poj2767,单向连通图判定,缩点+重新建图+新图DFS
/*该题被博客里标记为中等题,30分钟内1A,掌握了算法就简单了,单向连通图判定,单向连通图缩点 后必然唯一存在出度为0的点和入度为0的点,并且从入度为0的点出发,可以遍历所有点后到达出度为0点 (一 ...
- [Bzoj4817] [Sdoi2017]树点涂色 (LCT神题)
4817: [Sdoi2017]树点涂色 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 629 Solved: 371[Submit][Status ...
- DTrace C++ Mysteries Solved 转
I’ve been using DTrace on Leopard in my recent work, and while it’s a great tool, the C++ support ...
- cocoapods应用第一部分-xcode创建.framework相关
问题的提出: 随着项目的越来越大,可能会出现好几个团队共同维护一个项目的情况,比如:项目组A负责当中的A块,项目组B负责当中的B块.....这几块彼此之间既独立,也相互联系.对于这样的情况,能够採用约 ...
- ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library
ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library 须要安装pcre包. sudo apt-get upd ...
- Jenkins系列之-—01 简介&新建任务
一.Jenkins 简介 Jenkins是一个可扩展的持续集成引擎. 主要用于: l 持续.自动地构建/测试软件项目.l 监控一些定时执行的任务. Jenkins拥有的特性包括: l 易于安装-只要把 ...