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. C#.NET常见问题(FAQ)-想要另存一个项目,sln文件丢了怎么办,如何打开高版本的项目

    如下图所示,我想要另存一个工程,把 V4.4整个的项目另存为V4.5,我可以把解决方案文件(.sln)改名字,但是我没法把文件夹改名字,改了打开sln就说找不到.   很简单的一个思路是反正sln是多 ...

  2. 基于Teigha.Net实现CAD到SHP的转换方案

    CAD在测绘领域运用广泛,所以,现在有很多成果都是CAD格式,但其自身存在很多局限性,需将其转为支持更加广泛,存储更加完善的 SHP文件.ArcGIS中直接提供相关转换工具,但不能转换Xdata,Ar ...

  3. JavaScript三(语法、关键保留字及变量)

    基本概念 一.区分大小写 在ECMAScript中的一切(变量.函数名.操作符)都是区分大小写的. 如变量名test和Test分别表示两个不同的变量, 二.标识符 所谓标识符,就是指变量.函数.属性的 ...

  4. TQ2440烧写方法总结

    USB烧写 接线:需要连接串口线.USB下载线和电源线. 软件:USB转串口驱动(因为现在的笔记本上一般都没有串口).USB下载驱动和DNW. 网络烧写 接线:需要连接串口线.网线和电源线. 软件:T ...

  5. Strom优化指南

    摘要:本文主要讲了笔者使用Strom中的一些优化建议 1.使用rebalance命令动态调整并发度 Storm计算以topology为单位,topology提交到Storm集群中运行后,通过storm ...

  6. 用Python读取大文件

    通常我们在读取文件的时候,会用到read(), readline(), readlines(). 通常可能会有这样的用法: def test1(): with open("/tmp/test ...

  7. CSDN开源夏令营 基于Compiz的switcher插件设计与实现之compiz特效插件介绍及特效实现

    compiz自带的特效插件不够多,也不够强大.为了更好的体验compiz的特效,我们能够安装特效插件,在终端输入命令:sudo apt-get install compiz-plugins就能够下载特 ...

  8. Eclipse 中选中一个单词 ,其他相同的单词颜色就会变化

    "Window"-"preferences"-"Java"-"Editor"-"Mark Occurrence ...

  9. Ubuntu 下iscsi initiator的安装与使用

    Ubuntu下比较方便好用的initiator是open iscsi,这里将要简要介绍它的使用方法: 1.安装: sudo apt-get install open-iscsi 2.chap设置 如果 ...

  10. 判断是否为SIM卡联系人

    判断是否为SIM卡联系人 在AsyncQueryContacts类中. private List<TxrjAccount> accounts = new ArrayList<Txrj ...