1.下载nginx, 去http://nginx.org/en/download.html 下载,我下载的是1.8 stable版本。

2.配置文件/conf/nginx.conf

#user  nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#root /cygdrive/D/myjango;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}

location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|js)$
{
root D:/myjango;
expires 30d;
break
;
} location
~ ^/static/ {
root D:/myjango;
expires 30d;
break
;
}

location ~ ^/ {
fastcgi_pass 127.0.0.1:8051
;
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;
}

}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }

其他都没有改动,最重要的部分就是在server{}配置项里添加FASTCGI的配置和静态文件的路劲配置。

3. python 安装flup(Python的FastCGI组件)

pip install flup

4. 运行nginx服务器

D:\Users\rick.xu>cd D:\nginx-1.8.0\nginx-1.8.0

D:\nginx-1.8.0\nginx-1.8.0>start nginx.exe

5. 用FastCGI运行你的Django项目

D:\Users\rick.xu>cd D:\myjango

D:\myjango>python manage.py runfcgi method=threaded host=127.0.0.1 port=8051

6. 在刷新localhost就能看到你的界面了

Nginx + django windows下配置的更多相关文章

  1. nginx在windows下配置反向代理

    转自:https://blog.csdn.net/comeonyangzi/article/details/72466310 下载地址:http://nginx.org/download/ 下载后直接 ...

  2. Nginx + Tomcat Windows下的负载均衡配置

     Nginx + Tomcat Windows下的负载均衡配置 一.为什么需要对Tomcat服务器做负载均衡?    Tomcat服务器作为一个Web服务器,其并发数在300-500之间,如果超过50 ...

  3. windows 下配置 Nginx 常见问题(转)

    windows 下配置 Nginx 常见问题 因为最近的项目需要用到负载均衡,不用考虑,当然用大名鼎鼎的Nginx啦.至于Nginx的介绍,这里就不多说了,直接进入主题如何在Windows下配置. 我 ...

  4. Windows下配置Nginx

    一.今天是2017年1月18日.揣着一种也许叫做冲动的心情,决定以后每天都记录和回顾新涉及的技术,巩固已学到的知识,坚持. 二.回归到今天的技术主题,因为之前对于[反向代理]这种技术充满了好奇,借此机 ...

  5. windows 下配置 Nginx 常见问题

    因为最近的项目需要用到负载均衡,不用考虑,当然用大名鼎鼎的Nginx啦.至于Nginx的介绍,这里就不多说了,直接进入主题如何在Windows下配置. 我的系统是win7旗舰版的,到官网下载最新版本 ...

  6. 在CentOS/Windows下配置Nginx(以及踩坑)

    在CentOS/Windows下配置Nginx(以及踩坑) 1. 序言 因为这类文章网上比较多,实际操作起来也大同小异,所以我并不会着重于详细配置方面,而是将我配置时踩的坑写出来. 2. CentOS ...

  7. windows下配置wnmp

    最近尝试windows下配置nginx+php+mysql,在这里总结一下. 1.下载windows版本的nginx,官网​下载地址:http://nginx.org/en/download.htm, ...

  8. nginx+php windows安装配置

    https://blog.csdn.net/zjiang1994/article/details/72876193 https://blog.csdn.net/bruce_wang_janet/art ...

  9. Windows下配置使用 MemCached

    Windows下配置使用MemCached 工具: memcached-1.2.6-win32-bin.zip     MemCached服务端程序(for win) Memcached Manage ...

随机推荐

  1. 对应键盘的ASCII码(备忘)

    vbKeyLButton 1 鼠标左键 vbKeyRButton 2 鼠标右键 vbKeyCancel 3 CANCEL 键 vbKeyMButton 4 鼠标中键 vbKeyBack 8 Backs ...

  2. 【Linux】inode_针对MySQL读写操作在系统层的进一步学习【转】

    转自http://www.cnblogs.com/itech/archive/2012/05/15/2502284.html 一.inode是什么? 理解inode,要从文件储存说起. 文件储存在硬盘 ...

  3. What is the behavior of lnk files?

    I access a files which name is "abc.doc", no doubt a lnk file "abc.doc.lnk" show ...

  4. jsp-status 404错误的解决方法汇总

    接下来的解决方法实在一下情况下进行的: 1.tomcat配置是对的,能打开tomcat的主页(网址:http://localhost:8080/),如图, 但是在输入具体网址的时候,例如:http:/ ...

  5. Android IOS WebRTC 音视频开发总结(五七)-- 网络传输上的一种QoS方案

    本文主要介绍一种QoS的解决方案,文章来自博客园RTC.Blacker,欢迎关注微信公众号blacker,更多详见www.rtc.help QoS出现的背景: 而当网络发生拥塞的时候,所有的数据流都有 ...

  6. basis基本tcode

    SM21 ST11     SM50 查看work process 使用情况 操作相关的查询功能     SM## 常用tcode     SM01 锁定事务 SM04 用户清单 SM05 HTTP ...

  7. 简单记事本程序java源码项目

    代码如下 import java.awt.*; import java.io.*; import java.awt.datatransfer.*; import java.awt.event.*; p ...

  8. 移植u-boot.2012.04.01

    /*************************************************** *u-boot版本:u-boot2012.04.01 *gcc版本:arm-linux-gcc ...

  9. Linux命令行选项及参数

    1.main函数参数形式 int main(int argc , char *argv[] , char *env[]); //第一个参数argc代表命令行的参数个数 //第二个参数依次指向各个参数, ...

  10. jquery中选择ID以什么字符开头的匹配主要用于多个上传控件的时候,id无法使用,而且class不起作用的时候

    $("[id^=remark]")选择ID以remark开头的所有数据进行匹配