秀米云香港服务器

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

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

#usernobody;worker_processes1;#error_loglogs/error.log;#error_loglogs/error.lognotice;#error_loglogs/error.loginfo;#pidlogs/nginx.pid;events{worker_connections1024;}http{includemime.types;default_typeapplication/octet-stream;#log_formatmain'$remote_addr-$remote_user[$time_local]"$request"'#'$status$body_bytes_sent"$http_referer"'#'"$http_user_agent""$http_x_forwarded_for"';#access_loglogs/access.logmain;sendfileon;#tcp_nopushon;#keepalive_timeout0;keepalive_timeout65;#gzipon;server{listen80;server_namelocalhost;#charsetkoi8-r;#root/cygdrive/D/myjango;#access_loglogs/host.access.logmain;location/{roothtml;indexindex.htmlindex.htm;}#error_page404/404.html;#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}#proxythePHPscriptstoApachelisteningon127.0.0.1:80##location~.php${#proxy_passhttp://127.0.0.1;#}#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000##location~.php${#roothtml;#fastcgi_pass127.0.0.1:9000;#fastcgi_indexindex.php;#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;#includefastcgi_params;#}#denyaccessto.htaccessfiles,ifApache'sdocumentroot#concurswithnginx'sone##location~/.ht{#denyall;#}location~*^.+.(html|jpg|jpeg|gif|png|ico|css|js)${rootD:/myjango;expires30d;break;}location~^/static/{rootD:/myjango;expires30d;break;}location~^/{fastcgi_pass127.0.0.1:8051;fastcgi_paramPATH_INFO$fastcgi_script_name;fastcgi_paramREQUEST_METHOD$request_method;fastcgi_paramQUERY_STRING$query_string;fastcgi_paramCONTENT_TYPE$content_type;fastcgi_paramCONTENT_LENGTH$content_length;fastcgi_paramSERVER_PROTOCOL$server_protocol;fastcgi_paramSERVER_PORT$server_port;fastcgi_paramSERVER_NAME$server_name;fastcgi_pass_headerAuthorization;fastcgi_intercept_errorsoff;}}#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration##server{#listen8000;#listensomename:8080;#server_namesomenamealiasanother.alias;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}#HTTPSserver##server{#listen443ssl;#server_namelocalhost;#ssl_certificatecert.pem;#ssl_certificate_keycert.key;#ssl_session_cacheshared:SSL:1m;#ssl_session_timeout5m;#ssl_ciphersHIGH:!aNULL:!MD5;#ssl_prefer_server_cipherson;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}}

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

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

4. 运行nginx处事器

D:Usersick.xu>cdD:ginx-1.8.0ginx-1.8.0D:ginx-1.8.0ginx-1.8.0>startnginx.exe

标题:Nginx + django windows下设置

地址: https://www.yunhk.xyz/26073.html