Compile and install Nginx in Linux configure Python FastCGI Django (3) Configure nginx and django

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.