码迷,mamicode.com
首页 > Windows程序 > 详细

nginx + django windows上部署

时间:2015-03-06 18:45:03      阅读:502      评论:0      收藏:0      [点我收藏+]

标签:

nginx工作原理:

nginx用于处理静态文件,动态部分经由fastcgi 、scgi或uwsgi交给django处理!

1、在站点目录下执行:manage.py runfcgi host=127.0.0.1 port=8051 protocol=fcgi method=threaded

2、在D:\nginx-1.7.10下执行:nginx.exe

 

nginx.conf:

  server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

 location / {
            # host and port to fastcgi server
            ssi on;  
            ssi_silent_errors on;  
            ssi_types text/shtml;  
            
            fastcgi_pass localhost:8051; #用于和django交换数据的端口, 在执行"manage.py runfcgi host=127.0.0.1 port=8051 protocol=fcgi method=threaded" 端口号要一致
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param REQUEST_METHOD $request_method;
            fastcgi_param QUERY_STRING $query_string;
            fastcgi_param SERVER_NAME $server_name;
            fastcgi_param SERVER_PORT $server_port;
            fastcgi_param SERVER_PROTOCOL $server_protocol;
            fastcgi_param CONTENT_TYPE $content_type;
            fastcgi_param CONTENT_LENGTH $content_length;
            fastcgi_pass_header Authorization;
            fastcgi_intercept_errors off;
        }

}

3、在浏览器中输入http://localhost:8080即可访问!

nginx + django windows上部署

标签:

原文地址:http://www.cnblogs.com/jaxthon/p/4318899.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!