标签:
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即可访问!
标签:
原文地址:http://www.cnblogs.com/jaxthon/p/4318899.html