It's quite simple to run django on nginx on windows. Here are some key steps to follow -

1. Download nginx/windows from http://nginx.org/en/download.html

2. Unzip the pckage (like nginx-1.7.2.zip) to a folder in your machine)

3. Install flup (fastcgi connecting nginx and django) from https://pypi.python.org/pypi/flup

4. Configure nginx config file. Some key section is shown below,

server {
listen 8000;
server_name localhost; location ~ ^/ {
fastcgi_pass 127.0.0.1:8001;
#fastcgi_index index.html fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
}

Nginx would listen on 8000 port, and when you access the django site, it would pass the request to your django application listening on 8001 port.

Also add the following section to the conf file to tell nginx to render static files in your django application.

location ~ ^/static/ {
root "C:/Users/yufa/Desktop/Document/Study/Django/sqlmonitor/";
expires 30d;
# root html;
# index index.html index.htm;
break;
}

5. Start nginx (nginx.exe)

6. Start django, binding to nginx.

python manage.py runfcgi host=127.0.0.1 port=8001 protocol=fcgi method=threaded

7. It's done, open a browser, and try http://127.0.0.1:8000

nginx + django on windows的更多相关文章

  1. 用 Python+nginx+django 打造在线家庭影院

    用 Python+nginx+django 打造在线家庭影院 2018年11月29日 08:46:59 清如許 阅读数:1528   我喜欢看电影,尤其是好的电影,我会看上三四遍,仔细感受电影带给我的 ...

  2. Nginx+PHP On windows

    前期准备 Nginx 下载 http://nginx.org/   PHP下载 PHP Windows binaries       问题 问题1: opened a DOS window to la ...

  3. nginx配置为windows服务中的坑

    网上搜索“nginx 配置为windows服务”,很容易搜索到使用windows server warpper来配置,于是按照网上的方法我从github上的链接下载了1.17版本,前面都很顺利,很容易 ...

  4. Nginx添加到windows服务

    在windows平台,把Nginx注册到服务,又可以启动.停止和重启的方法,网上并没找到好的办法. 既然如此,唯有自己写程序实现了 使用C#进行编写,有兴趣的可以下载源码自己改:源码下载(2016-1 ...

  5. nginx TCP 代理& windows傻瓜式安装

    一.下载nginx Windows http://nginx.org/en/download.html 二.解压到目录 三.进入目录并start nginx.exe即可启动 cd d:/java/ng ...

  6. Nginx+Django+Uwsgi+php

    在FreeBSD结合Nginx和FastCGI简单配置Django和PHP  http://blog.chinaunix.net/uid-11131943-id-3031767.html Nginx+ ...

  7. Nginx 安装成 Windows 服务

    Nginx 安装成Windows 服务方法,具体方法如下 1. 下载nginx windows版本 http://www.nginx.org 2. 下载微软的2个工具: instsrv.exe.srv ...

  8. 把 Nginx 创建为 Windows 的一个服务

    译序:Nginx 不是为 Windows 而写.Nginx 是用在软件的工作环境中的.但软件开发环境一般都是 Windows,有时调试的需要也要装 Nginx,但 Nginx 并没给 Windows ...

  9. Windows Server 2008 R2下将nginx安装成windows系统服务

    一直在Linux平台上部署web服务,但是最近的一个项目,必须要用windows,不得已再次研究了nginx在windows下的表现,因为Apache httpd在Windows下表现其实也不算太好, ...

随机推荐

  1. jquery解析XML及获取XML节点名称

    ).tagName $().tagName [].tagName[] $(].tagName context.nodeName $(this).context.nodeName function ge ...

  2. 如何使用Ultraiso制作U盘启动盘

    准备好可启动的ISO文件和足够容量的U盘.点击工具-写入硬盘镜像. 各种U盘启动模式简介 1.USB-HDD:硬盘仿真模式,DOS启动后显示C:盘,HP U盘格式化工具制作的U盘即采用此启动模式.此模 ...

  3. 火狐浏览器Firefox如何使用插件,火狐有哪些好用的插件

    1 CoorPreviews 不打开网页链接预览该网页的内容. 预览如图所示: 点击关闭旁边的钉子可以让该窗口保持开着并且浏览速度加快.这对于快速浏览图片时非常有用. 2 FoxTab 3D方式预览网 ...

  4. Tomcat环境的搭建(web基础学习笔记一)

    一.下载和安装Tomcat服务器 下载Tomcat安装程序包:http://tomcat.apache.org/ 点击[Download]跳转到如下图所示的下载页面 二.点击左侧要下载的版本,选择To ...

  5. storm0.9.0.1升级安装

    来自:http://blog.csdn.net/liuzhoulong/article/details/21112101 1,下载0.9.0.1 http://storm.incubator.apac ...

  6. CSS3去除手机浏览器button点击出现的高亮框

    在工作中常常遇到在手机浏览器中浏览网页时.点击页面中的button或者是具备点击事件的元素,就会出现一个默认的高亮框.影响总体的感官体验. 能够用一个简单的css3属性来解决:tap-highligh ...

  7. sql distinct 不能比较或排序 text、ntext 和 image 数据类型,除非使用 IS NULL 或 LIKE 运算符

    有个文章的表内容是列项,类型是text 我查询的是内容相同的文章,把其中的一个删除 select 内容 from 文章 group by 内容 having count(*)>1 查询ID和题目 ...

  8. MongoDB和关系型数据库简单对比

    MongoDB 是一个跨平台的,面向文档的数据库,提供高性能,高可用性和可扩展性方便. MongoDB 工作在收集和文件的概念. 数据库:数据库是一个物理容器集合.每个数据库都有自己的一套文件系统上的 ...

  9. vsftp客户连接常见故障现象

    ftp客户连接常见故障现象现象0:> ftp: connect :连接被拒绝原因: 服务没启动解决: # chkconfig vsftpd on<Enter> 现象1:500 OOP ...

  10. Drupal的$messages是怎么显示的?

    Drupal的默认主题bartik会在页面顶部显示系统信息,例如警告.状态等.这个过程是如何实现的? 首先,在bartik目录下找到page.tpl.php,这是bartik主题的页面显示模板.其中有 ...