nginx1.4.7+uwsgi+django1.9.2+gridfs 在ubuntu14.0.4上部署
本文基于root用户安装配置,实现django项目名为trcode
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python2.7-dev
sudo python2.7 -m pip install uwsgi
pip install Django==1.9.2
安装剩余环境包
项目根目录创建trcode_uwsgi.ini
# trcode_uwsgi.ini file
[uwsgi]
# Django-related settings
socket = :8000
# the base directory (full path)
chdir = /home/trcode
# Django s wsgi file
module = trcode.wsgi
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 4
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
cd /home/trcode
项目启动uwsgi
uwsgi --ini trcode_uwsgi.ini
安装nginx同时添加nginx-gridfs
1、安装各种依赖包
apt-get install zlib1g-dev
apt-get install libpcre3 libpcre3-dev
apt-get install openssl libssl-dev
2、安装nginx-gridfs
apt-get install git
git clone https://github.com/mdirolf/nginx-gridfs.git
cd nginx-gridfs
git checkout v0.8
git submodule init
git submodule update
cd
3、安装nginx
wget http://nginx.org/download/nginx-1.4.7.tar.gz
tar zxvf nginx-1.4.7.tar.gz
cd nginx-1.4.7
./configure --with-openssl=/usr/include/openssl --add-module=../nginx-gridfs/
#进入主目录 gedit objs/Makefile修改一个小错误,把第3行的-Werror错误去掉,不然会报一个unused错误
make
make install
gedit /usr/local/nginx/conf/nginx.conf文件,http中添加如下内容。
user 修改为root
server {
# the port your site will be served on
listen 8001;
# the domain name it will serve for
server_name .example.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8000;
uwsgi_read_timeout 2;
}
# Django static
location /static {
root /home/trcode/static; # your Django project's static files - amend as required
}
#Gridfs
#[root_collection]: 选择collection,如root_collection=blog, mongod就会去找blog.files与blog.chunks两个块,默认是fs
#[field]:查询字段,保证mongdb里有这个字段名,支持_id, filename, 可省略, 默认是_id
#[type]:解释field的数据类型,支持objectid, int, string, 可省略, 默认是int
#[user]:用户名, 可省略
#[pass]:密码, 可省略
location /file/ {
gridfs trdb
root_collection=fs
field=_id
type=objectid;
#这里的mongo以slave模式启动会有问题?
mongo 192.168.100.102:27017;
}
location /img/ {
gridfs trdb
root_collection=img
field=_id
type=objectid;
#这里的mongo以slave模式启动会有问题?
mongo 192.168.100.102:27017;
}
}
/usr/local/nginx/sbin/nginx 启动
/usr/local/nginx/sbin/nginx -s reload 重启nginx,访问8001成功
killall -9 uwsgi 关闭uwsgi进程
nginx1.4.7+uwsgi+django1.9.2+gridfs 在ubuntu14.0.4上部署的更多相关文章
- nginx1.4.7+uwsgi+django1.9.2项目部署,liunx系统为ubuntu14.0.4。
本文基于root用户下进行部署,django项目名称为BDFS 1. 安装依赖包,终端输入命令 1) 环境依赖包 apt-get update apt-get install pyt ...
- Django线上部署教程:腾讯云+Ubuntu+Django+Uwsgi(转载)
网站名称: 向东的笔记本 本文链接: https://www.eastnotes.com/post/29 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议.转载请注明出处! ...
- CentOS上部署Django+Nginx+Uwsgi环境
在CentOS上部署Django+Nginx+Uwsgi环境 奇谭 2016-09-01 评论 Linux python django nginx uwsgi VirtualEnv的作用:创建隔 ...
- Django+Nginx+Uwsgi(全网最全步骤工作原理流程与部署历程)
一.必要前提 1.1 准备知识 django 一个基于python的开源web框架,请确保自己熟悉它的框架目录结构. uWSGI 一个基于自有的uwsgi协议.wsgi协议和http服务协议的web网 ...
- Ubuntu16.04下部署 nginx+uwsgi+django1.9.7(虚拟环境pyenv+virtualenv)
由于用的新版本系统,和旧的稍有差别,在网上搜了很多相关资料,搞了三天终于搞好在Ubuntu16.04下的部署,接下来就详细写写步骤以及其中遇到的问题.前提是安装有虚拟环境pyenv+virtualen ...
- ubuntu12上部署Django1.8.4+uwsgi+nginx超级详细流程配置到云服务器
环境: 系统:ubuntu12,系统自带默认有python2.7 框架:Django1.8.4,需要python2.7以上才能支持 前言: 用户浏览器发送http请求->nginx(静态文件 ...
- nginx+uwsgi+django1.8.5配置
http://jingyan.baidu.com/article/2d5afd69cdf6ad85a3e28e4f.html(搜索: wusgi 配置django1.8项目) http://my.os ...
- 在UOS 上部署 django + uwsgi + nginx 流程
前言:这篇主要是流程,不喜勿喷,虽然我知道在部署过程中 参照博客写的越详细越好. 强大的百度会解决一切的 爬了诸多坑 ,心累,必须总结!! 最近 芯片封锁闹的很凶 支持国产!! UOS 统一操作系统 ...
- 基于nginx和uWSGI在Ubuntu上部署Djan
http://www.jianshu.com/p/e6ff4a28ab5a 文/Gevin(简书作者)原文链接:http://www.jianshu.com/p/e6ff4a28ab5a著作权归作者所 ...
随机推荐
- Linux下 安装VMware Tools工具
Linux下需要安装VMware Tools工具 Linux下需要安装VMware Tools工具来实现主机和虚拟机直接文件复制粘贴功能,安装方法如下: ①点击虚拟机VM菜单栏--虚拟机--安装VMw ...
- 图解avaScript中this指向(超透彻)
一个图讲清楚JavaScript中this指向: 说明: (1)严格模式下,禁止this关键字指向全局对象会报错. (2)闭包中的this对象具有全局性,因此通常指向window. (3)优先级:n ...
- 【Java】Java_09 类型转换
1.自动类型转换 自动类型转换:容量小的数据类型可以自动转换为容量大的数据类型.在图中,黑色的实线表示无数据丢失的自动类型转换,而红色的虚线表示在转换时可能会精度的损失. 特例: 可以将整型常量直接赋 ...
- iOS CoreImage之滤镜简单使用
代码地址如下:http://www.demodashi.com/demo/11605.html 老骥伏枥,志在千里 前记 最近一直在研究图像处理方面,既上一篇iOS Quart2D绘图之UIImage ...
- tomcat war包自动化部署脚本
#/bin/bash #带发布build的war包名称 war_name="weiFeng.war" war_dir="/home/deploy/wei_feng_tar ...
- rac_安装软件时报版本号过高问题
原创作品,出自 "深蓝的blog" 博客.欢迎转载,转载时请务必注明下面出处,否则追究版权法律责任. 深蓝的blog:http://blog.csdn.net/huangyanlo ...
- Scikit-learn的kmeans聚类
1. 生成随机的二维数据: import numpy as np x1 = np.array([1, 2, 3, 1, 5, 6, 5, 5, 6, 7, 8, 9, 9]) x2 = np.arra ...
- php对象序列化总出错false
php unserialize 返回false的解决方法 php 提供serialize(序列化) 与unserialize(反序列化)方法. 使用serialize序列化后,再使用unseriali ...
- Verilog HDL test bench 문법에 관한
16bit ripple carry adder test bench `timescale 1ns/1ns module testbench2; reg [15:0] a, [15:0] b, c_ ...
- C#检测浏览器类型 Detect Browser
private void Button1_Click(object sender, System.EventArgs e) { System.Web.HttpBrowserCapabilities b ...