Nginx and django are correctly installed.
Now you need to configure nginx
Open the nginx configuration file
Vi/usr/local/nginx/conf/nginx. conf
Modify location /{
} Is configured
Location /{
Fastcgi_pass 127.0.0.1: 8000;
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;
}
After modification, You need to reload nginx
/Usr/local/nginx/sbin/nginx-s reload
Start django
Go to the django project directory
Run
Python2.6 manage. py runfcgi method = threaded host = 127.0.0.1 port = 8000
Notes
Host and port must be configured with nginx
Fastcgi_pass 127.0.0.1: 8000; consistent information
For more information, see this official document.