nginx + django on windows
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的更多相关文章
- 用 Python+nginx+django 打造在线家庭影院
用 Python+nginx+django 打造在线家庭影院 2018年11月29日 08:46:59 清如許 阅读数:1528 我喜欢看电影,尤其是好的电影,我会看上三四遍,仔细感受电影带给我的 ...
- Nginx+PHP On windows
前期准备 Nginx 下载 http://nginx.org/ PHP下载 PHP Windows binaries 问题 问题1: opened a DOS window to la ...
- nginx配置为windows服务中的坑
网上搜索“nginx 配置为windows服务”,很容易搜索到使用windows server warpper来配置,于是按照网上的方法我从github上的链接下载了1.17版本,前面都很顺利,很容易 ...
- Nginx添加到windows服务
在windows平台,把Nginx注册到服务,又可以启动.停止和重启的方法,网上并没找到好的办法. 既然如此,唯有自己写程序实现了 使用C#进行编写,有兴趣的可以下载源码自己改:源码下载(2016-1 ...
- nginx TCP 代理& windows傻瓜式安装
一.下载nginx Windows http://nginx.org/en/download.html 二.解压到目录 三.进入目录并start nginx.exe即可启动 cd d:/java/ng ...
- Nginx+Django+Uwsgi+php
在FreeBSD结合Nginx和FastCGI简单配置Django和PHP http://blog.chinaunix.net/uid-11131943-id-3031767.html Nginx+ ...
- Nginx 安装成 Windows 服务
Nginx 安装成Windows 服务方法,具体方法如下 1. 下载nginx windows版本 http://www.nginx.org 2. 下载微软的2个工具: instsrv.exe.srv ...
- 把 Nginx 创建为 Windows 的一个服务
译序:Nginx 不是为 Windows 而写.Nginx 是用在软件的工作环境中的.但软件开发环境一般都是 Windows,有时调试的需要也要装 Nginx,但 Nginx 并没给 Windows ...
- Windows Server 2008 R2下将nginx安装成windows系统服务
一直在Linux平台上部署web服务,但是最近的一个项目,必须要用windows,不得已再次研究了nginx在windows下的表现,因为Apache httpd在Windows下表现其实也不算太好, ...
随机推荐
- 【死磕Java并发】-----深入分析synchronized的实现原理
记得刚刚開始学习Java的时候.一遇到多线程情况就是synchronized.相对于当时的我们来说synchronized是这么的奇妙而又强大,那个时候我们赋予它一个名字"同步". ...
- cat 命令(转)
原文:http://www.cnblogs.com/peida/archive/2012/10/30/2746968.html cat命令的用途是连接文件或标准输入并打印.这个命令常用来显示文件内容, ...
- flume hdfs一些简单配置记忆
############################################ # producer config ##################################### ...
- matlab histeq函数介绍
Histeq Enhance contrast using histogram equalization 该函数通过直方图均衡化来添加对照度 Syntax J = histeq(I,hgram) De ...
- PowerMock介绍
一.为什么要使用Mock工具 在做单元测试的时候,我们会发现我们要测试的方法会引用很多外部依赖的对象,比如:(发送邮件,网络通讯,远程服务, 文件系统等等). 而我们没法控制这些外部依赖的对象,为了解 ...
- 记录规则 – 销售只能看到自己的客户,经理可以看到全部
OpenERP中的权限管理有四个层次: 菜单级别: 即,不属于指定菜单所包含组的用户看不到该菜单.不安全,只是隐藏菜单,若用户知道菜单ID,仍然可以通过指定URL访问 对象级别: 即,对某个对象是否有 ...
- cocos2d-x项目101次相遇-安装和环境搭建 -xcode
cocos2d-x 101次相遇 / 文件夹 1 安装和环境搭建 -xcode 2 Scenes . Director, Layers, Sprites 3 建立图片菜单 4 在 ...
- servlet 多线程
servlet在服务器中只有一个实例,那么它响应请求的方式应该是多线程. 一,servlet容器如何同时处理多个请求. Servlet采用多线程来处理多个请求同时访问,Servelet容器维护了一个线 ...
- 在centos (linux) 搭建 eclipse c++开发分环境
网上说得很多,很烦,操作了很多,总有错误,但解决方案很简单.步骤就下面几步就OK了 安装gcc .g++ yum install gcc yum install gcc-c++ 安装jdk,配置jdk ...
- 走进 Realm 的世界
来源:XcodeMen(郭杰) 链接:http://www.jianshu.com/p/0e248f000405 本文由我们团队的郭杰童鞋分享. Realm是什么 Realm是由Y Combinato ...