0. The goal is to integrate the dapper Nginx and Django through Uwsgi
1. Pre-Environment Python 2.7.8 @ Ubuntu Server 14.04.2 version
2. Install Django (PIP is used here, of course easy_install is also possible)
sudo pip install django==1.8
3. Installing Nginx
sudo apt-get install nginx
4. Installing Uwsgi
sudo apt-get install uwsgi
5. Create a Django project +app
>>python django-admin.py startproject cloud_shield
>>cd cloud_shield
>>python manage.py startapp cloud_proxy
6. Separately on the code and configuration diagram
(Here are just a few of the main configuration diagrams that need to be modified for the file)
1.首先完善django 的app,即在 cloud_proxy/views.py中写个简单的回复request请求的方法
settings.py中添加 app和 static_URL
还有urls.py中添加对用的(r^$ 'cloud_proxy.views.cs_receive_request'),的过滤器
其实上面这些对于熟悉Django的同学来说都不用赘述,但是为了让大家不管是否有基础都看清楚细节,还是了~
The above completes the Django configuration, the following to configure Nginx; configuration file cloud_shield_nginx.conf in the project root directory
This file will be placed in the Nginx directory under a soft connection, let Nginx know this configuration file, this soft link must be configured well, well after the sites-enabled is also able to use VI to view;
>> sudo ln -s /home/bw/cloud_shield/cloud_shield_nginx.conf /etc/nginx/sites-enabled/
There is also a small detail, in the first line of/etc/nginx/nginx.conf start with a user www-data; This will be changed to user's current system users; (It would be nice to have an account that was specifically customized for the server)
Last Configuration Uwsgi
There are 502 of errors that can occur during the intermediate configuration process, and the workaround is as follows:
When a system service such as Nginx fails to start:>>tail /var/log/syslog
When the server internal error occurs:>>tail ~/bw/cloud_shield/uwsgi/uwsgi.log
To make the server check error:
>>nginx -c some_conf_file
You can only check Nginx's own file here.
Finally: The following is the entire project tree view (the folder inside is the final completion of the appearance, many files are created manually)
The last Nginx tree is (mostly a soft link):
With the last configured DNS server, the final result is:
In fact, there are a lot of small details need to pay attention to, the author here can not one by one, but the direction and methods to solve the problem are put this ~
If you have any questions, please do not hesitate to enlighten
This article was released in the Personal forum: http://itpark.sinaapp.com/thread-index-fid-4-tid-295-typeid1-7-typeid2-0-typeid3-0-typeid4-0.htm
If there is reprint, please indicate the source!
The above describes the Ubuntu Server 14.04.2 LTS configuration Nginx + Uwsgi + Django, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.