本文基于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上部署的更多相关文章

  1. nginx1.4.7+uwsgi+django1.9.2项目部署,liunx系统为ubuntu14.0.4。

    本文基于root用户下进行部署,django项目名称为BDFS 1.  安装依赖包,终端输入命令 1)         环境依赖包 apt-get update apt-get install pyt ...

  2. Django线上部署教程:腾讯云+Ubuntu+Django+Uwsgi(转载)

    网站名称: 向东的笔记本 本文链接: https://www.eastnotes.com/post/29 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议.转载请注明出处! ...

  3. CentOS上部署Django+Nginx+Uwsgi环境

    在CentOS上部署Django+Nginx+Uwsgi环境 奇谭  2016-09-01 评论  Linux  python django nginx uwsgi VirtualEnv的作用:创建隔 ...

  4. Django+Nginx+Uwsgi(全网最全步骤工作原理流程与部署历程)

    一.必要前提 1.1 准备知识 django 一个基于python的开源web框架,请确保自己熟悉它的框架目录结构. uWSGI 一个基于自有的uwsgi协议.wsgi协议和http服务协议的web网 ...

  5. Ubuntu16.04下部署 nginx+uwsgi+django1.9.7(虚拟环境pyenv+virtualenv)

    由于用的新版本系统,和旧的稍有差别,在网上搜了很多相关资料,搞了三天终于搞好在Ubuntu16.04下的部署,接下来就详细写写步骤以及其中遇到的问题.前提是安装有虚拟环境pyenv+virtualen ...

  6. ubuntu12上部署Django1.8.4+uwsgi+nginx超级详细流程配置到云服务器

    环境: 系统:ubuntu12,系统自带默认有python2.7 框架:Django1.8.4,需要python2.7以上才能支持   前言: 用户浏览器发送http请求->nginx(静态文件 ...

  7. nginx+uwsgi+django1.8.5配置

    http://jingyan.baidu.com/article/2d5afd69cdf6ad85a3e28e4f.html(搜索: wusgi 配置django1.8项目) http://my.os ...

  8. 在UOS 上部署 django + uwsgi + nginx 流程

    前言:这篇主要是流程,不喜勿喷,虽然我知道在部署过程中 参照博客写的越详细越好. 强大的百度会解决一切的 爬了诸多坑 ,心累,必须总结!! 最近 芯片封锁闹的很凶  支持国产!! UOS 统一操作系统 ...

  9. 基于nginx和uWSGI在Ubuntu上部署Djan

    http://www.jianshu.com/p/e6ff4a28ab5a 文/Gevin(简书作者)原文链接:http://www.jianshu.com/p/e6ff4a28ab5a著作权归作者所 ...

随机推荐

  1. Android开发之Is Library篇

    一.生活场景描述 由于公司有一个项目开发的时间比较长,项目里堆砌的代码也比较多,并且有些功能在给不同客户发布的时候有些功能还不需要,这样功能模块分离就很有必要了. 所以,Library就被推到了前台, ...

  2. WP8 NavigationInTransition实现页面切换效果

    NavigationInTransition这个是实现页面切换效果,而且没控件来拖,要自己手动写, 将App.xaml.cs中InitializePhoneApplication()函数里的RootF ...

  3. SQL联查语句加上order排序之后速度超级慢

    项目中使用到了分页查询,形式如下 select * from ( select row_number() over (order by a.id0) as seq,a.* from PMS_T_D_S ...

  4. Spark学习(一) 基本操作

    先来一个简单的spark小程序,这是官网上的小样例,目的就是统计spark以下的README文档中包括字母a和字母b的个数,然后 打印,代码例如以下: object BasicStandaloneAp ...

  5. android应用多线程守护让你非常难杀死它

    1.android 应用开启后启动一个服务 public class TestserviceActivity extends Activity { /** Called when the activi ...

  6. atitit.人脸识别的应用场景and使用最佳实践 java .net php

    atitit.人脸识别的应用场景and使用最佳实践 java .net php 1. 人脸识别的应用场景1 2. 标准化的api1 3. 框架选型 JNI2OpenCV.dll and JavaCV ...

  7. 关于top按钮的网页设置

    方法一: 直接用html实现,没有缓冲的效果,直接彪到顶部. HTMl: <a id="return-top" href="#top"> <s ...

  8. 看好你的门-攻击服务端(3)-SOAP注入攻击

    首先须要声明,本文纯属一个毫无远见和真才实学的小小开发者的愚昧见解.仅供用于web系统安全方面的參考. 1.SOAP注入攻击 server端的XML解析引擎从client接收输入信息.这里指的clie ...

  9. layui中table表格的操作列(删除,编辑)等按钮的操作

    暂停和中止按钮功能 if (obj.event === 'del') { layer.confirm('确认中止么', function (index) { $.ajax({ type: " ...

  10. Android Studio--NDK编译C代码为.so文件,JNI调用

    前言: 从Android Studio开始,就支持jni和.so库调用了. 环境: Windows 7+Android Studio2.1.2+NDK版本:android-ndk-r10e 准备工作: ...