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 8088;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / {
# #root html;
# root D:/nginx/html;
# index index.html index.htm; location / {
root D:/www;
index index.html index.htm;
} location /nginx-status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all; # For Django demo with nginx using fastcgi (external server), it works on the root url as showned below. # In the django project directory, using the command
# python manager.py runfcgi [protocol=fcgi] method=threaded --settings=settings
# to start the fastcgi server process.
# Of cource, it can be registered as a windows service, so it can be started automatically with the system.
# NOTE: the method=threaded is required under Windows,
# for there is no prefork could be used under Windows platform.
# See python manager.py --help and python manager.py runfcgi --help for details. # BEGIN SETTINGS FOR DJANGO DEMO ON THE ROOT URL
#location /media {
# root D:/Python25/Lib/site-packages/django/contrib/admin;
#} #location / {
# # host and port to fastcgi server
# fastcgi_pass 127.0.0.1:8090; # fastcgi_param GATEWAY_INTERFACE CGI/1.1;
# fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; # fastcgi_param QUERY_STRING $query_string;
# fastcgi_param REQUEST_METHOD $request_method;
# fastcgi_param CONTENT_TYPE $content_type;
# fastcgi_param CONTENT_LENGTH $content_length; # fastcgi_param PATH_INFO $fastcgi_script_name;
# fastcgi_param REQUEST_URI $request_uri;
# fastcgi_param DOCUMENT_URI $document_uri;
# fastcgi_param DOCUMENT_ROOT $document_root; # fastcgi_param SERVER_PROTOCOL $server_protocol;
# fastcgi_param SERVER_ADDR $server_addr;
# fastcgi_param SERVER_PORT $server_port;
# fastcgi_param SERVER_NAME $server_name; # fastcgi_param REMOTE_ADDR $remote_addr;
# fastcgi_param REMOTE_PORT $remote_port; # fastcgi_pass_header Authorization;
# fastcgi_intercept_errors off; # END FOR DJANGO DEMO ON THE ROOT URL # For Django pinax complete_project with nginx using fastcgi (external server),
# it works on the root url as showned below. # Due to the invocation of external apps and libs, the path of the external apps and libs invocated
# should be added to sys.path in the setting file settings.py. # BEGIN SETTINGS FOR DJANGO PINAX COMPLETE_PROJECT
location /media {
root D:/Python25/Lib/site-packages/django/contrib/admin;
} location /site_media {
root D:/Django/pinax/projects/complete_project;
} # The settings for location / following work!
#location / {
# # host and port to fastcgi server
# fastcgi_pass 127.0.0.1:8090; # fastcgi_param GATEWAY_INTERFACE CGI/1.1;
# fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; # fastcgi_param QUERY_STRING $query_string;
# fastcgi_param REQUEST_METHOD $request_method;
# fastcgi_param CONTENT_TYPE $content_type;
# fastcgi_param CONTENT_LENGTH $content_length; # fastcgi_param PATH_INFO $fastcgi_script_name;
# fastcgi_param REQUEST_URI $request_uri;
# fastcgi_param DOCUMENT_URI $document_uri;
# fastcgi_param DOCUMENT_ROOT $document_root; # fastcgi_param SERVER_PROTOCOL $server_protocol;
# fastcgi_param SERVER_ADDR $server_addr;
# fastcgi_param SERVER_PORT $server_port;
# fastcgi_param SERVER_NAME $server_name; # fastcgi_param REMOTE_ADDR $remote_addr;
# fastcgi_param REMOTE_PORT $remote_port; # fastcgi_pass_header Authorization;
# fastcgi_intercept_errors off;
#} # Another method of setting the location /, using the file fastcgi_params_python
# See the file fastcgi_params_python.
location /pinax {
fastcgi_pass 127.0.0.1:8090; include fastcgi_params_python;
# What are the following two lines for? It also works without them.
#fastcgi_pass_header Authorization
#fastcgi_intercept_errors off; # END FOR DJANGO PINAX COMPLETE_PROJECT # For MoinMoin with nginx using fastcgi (external server), it works on the root url as showned below.
# BEGIN SETTINGS FOR MOINMOIN ON THE ROOT URL
#location /moin_static184 {
# alias D:/moin-1.8.4/wiki/htdocs;
#} #location / {
# # host and port to fastcgi server
# fastcgi_pass 127.0.0.1:8089; # fastcgi_param GATEWAY_INTERFACE CGI/1.1;
# fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; # fastcgi_param QUERY_STRING $query_string;
# fastcgi_param REQUEST_METHOD $request_method;
# fastcgi_param CONTENT_TYPE $content_type;
# fastcgi_param CONTENT_LENGTH $content_length; # fastcgi_param PATH_INFO $fastcgi_script_name;
# fastcgi_param REQUEST_URI $request_uri;
# fastcgi_param DOCUMENT_URI $document_uri;
# fastcgi_param DOCUMENT_ROOT $document_root; # fastcgi_param SERVER_PROTOCOL $server_protocol;
# fastcgi_param SERVER_ADDR $server_addr;
# fastcgi_param SERVER_PORT $server_port;
# fastcgi_param SERVER_NAME $server_name; # fastcgi_param REMOTE_ADDR $remote_addr;
# fastcgi_param REMOTE_PORT $remote_port; # fastcgi_pass_header Authorization;
# fastcgi_intercept_errors off; # END FOR MOINMOIN ON THE ROOT URL # For MoinMoin using fastcgi (external server) under the /moin/ url.
# It works on my moin-1.8.4 without hacking the moinmoin code!
# See also the file fastcgi_params_python.
# BEGIN SETTINGS FOR MOINMOIN UNDER THE /moin/ URL
location /moin_static184 {
alias D:/moin-1.8.4/wiki/htdocs;
} location /moin {
fastcgi_pass 127.0.0.1:8089; include fastcgi_params_python;
# The following 5 lines is added according to the instructions at this url:
# http://johnleach.co.uk/words/archives/2008/06/29/315/
# But I find that the MoinMoin 1.8.4 works well without these lines except the last line, and it is a
# fastcgi param, but not a hacking!
# As mentioned above, the variable PATH_INFO has been set in the file fastcgi_params_python included. #if ($fastcgi_script_name ~ ^/moin(.*)) {
# set $moin_url $1; #fastcgi_param PATH_INFO $moin_url;
#fastcgi_param SCRIPT_NAME /moin; fastcgi_param SCRIPT_NAME /moin; # END SETTINGS FOR MOINMOIN UNDER THE /moin/ URL # For MoinMoin wiki farm using fastcgi (external server) under the /moin url, see the following settings.
# BEGIN SETTINGS FOR MOINMOIN WIKI FARM USING FASTCGI
#location /moin_static184 {
# alias D:/moin/htdocs;
#} #location /moin/pim {
# fastcgi_pass 127.0.0.1:8089; # include fastcgi_params_python;
# fastcgi_param SCRIPT_NAME /moin/pim;
#} #location /moin/akb {
# fastcgi_pass 127.0.0.1:8089; # include fastcgi_params_python;
# fastcgi_param SCRIPT_NAME /moin/akb; # END FOR MOINMOIN WIKI FARM USING FASTCGI UNDER THE /moin/ URL #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; }
# 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;
# server_name localhost; # ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm; #}
}
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。