Nginx Proxy Django Installation configuration instance under Windows _nginx

Source: Internet
Author: User

I. Installation of Djanjo
1, download the source code
https://www.djangoproject.com/download/

This article downloads the Djanjo version is 1.5.1, the download link is as follows:

Https://www.djangoproject.com/m/releases/1.5/Django-1.5.1.tar.gz

2, installation

Enter the source directory to execute the following command:

Copy Code code as follows:

Python setup.py Install

3. Verify Djanjo
Copy Code code as follows:

>>> Import Django
>>> Print (django.__path__)
[' C:\\python27\\lib\\site-packages\\django ']
>>> print (Django.get_version ())
1.5.1

Second, the use of Djanjo to generate a simple web page

1. Add Environment variables

Add the file django-admin.py directory "C:\Python27\Scripts" to the PATH variable.

2. Create Djanjo Project

Copy Code code as follows:

django-admin.py startproject testSite1 # Create Diango Project TestSite1
CD testSite1
manage.py Runserver 8090 # provides services on 8090 ports

This can be accessed through 127.0.0.1, but not through local LAN IP.

Third, the use of Nginx agent

1, download Nginx

URL: http://nginx.org/en/download.html

This article uses the Nginx version link: http://nginx.org/download/nginx-1.4.1.zip

2. Configure Nginx

Enter the Conf folder, open the Nginx.conf file, add (or modify to) the following:

Copy Code code as follows:

server {
Listen 80; # Note Port occupancy issues

Location/{
Proxy_pass http://127.0.0.1:8090;
}
}

3. Operation effect

As you can see from the diagram, the virtual machine can access the Web site normally through the IP address.

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.