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著作权归作者所 ...
随机推荐
- SSH框架优势
SSH框架优势 1. 典型的三层构架体现MVC(模型Model,视图View和控制)思想,可以让开发人员减轻重新建立解决复杂问题方案的负担和精力.便于敏捷开发出新的需求,降低开发时间成本. 2. ...
- INSTALL_FAILED_OLDER_SDK
Uploading file local path: /Users/Rubert/Android/workspace/MyApplication/app/build/outputs/apk/app-d ...
- linux下统计程序/函数运行时间(转)
一. 使用time 命令 例如编译一个hello.c文件 #gcc hello.c -o hello 生成了hello可执行文件,此时统计该程序的运行时间便可以使用如下命令 #time ./hello ...
- Android之——ContentResolver查询的三种方式
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/47785491 今天做到一个小项目.查询手机中短信的信息,当然得去系统暴露出来的数据 ...
- java filter、listener、servlet
listener http://www.cnblogs.com/xdp-gacl/p/3969249.html http://blog.csdn.net/java_pengjin/article/de ...
- URL中的#号
一.#的涵义 #代表网页中的一个位置.其右面的字符,就是该位置的标识符.比如, http://www.example.com/index.html#print 就代表网页index.html的prin ...
- awk 截取字符串
1.把字符串的变量存入到其他变量中 1.1.编辑 shell 文件 [root@m910-120 test]# vi awkTest.sh ips=10.0.204.217:10.0.204.218 ...
- 搞IT的技术人员为什么会如此苦逼
http://www.cnblogs.com/springmvc-hibernate/archive/2012/05/10/2493733.html ————————————————————————— ...
- 第一百八十节,jQuery-UI,知问前端--消息提示 UI
jQuery-UI,知问前端--消息提示 UI 学习要点: 1.HTML 部分 2.CSS 部分 3.jQuery 部分 通过前面已学的 jQuery UI 部件,我们来创建一个注册表单. html ...
- Spring MVC生成RSS源
下面的示例演示如何使用Spring Web MVC框架生成RSS源. 首先使用Eclipse IDE,并按照以下步骤使用Spring Web Framework开发基于动态表单的Web应用程序: 创建 ...