: This article mainly introduces Nginx + uWsgi + Django. For more information about PHP tutorials, see. Nginx + uWsgi + Django
System environment: Ubuntu 14.04LTS
Nginx
Official website: http://nginx.org/
Install
1. system installation
$sudo apt-get install nginx
2. source code installation
Download the source code package from the official website: We recommend you download the stable version.
Address: http://nginx.org/en/download.html
Install dependency Library
Decompress, configure, compile, and install
$tar zxvf nginx-1.8.0.tar.gz$cd nginx-1.8.0$./configure --with-pcre--with-http_ssl_module--with-http_realip_module--with-http_gzip_static_module--with-http_secure_link_module--with-http_stub_status_module--with-debug$make$sudo make install
Run the following command to view the installation address:
whereis nginx
The default installation path is/usr/local/nginx.
During startup, the nginx module is not fully installed because the command cannot be identified.
$sudo apt-get install nginx-core
Then start nginx
sudo nginx
Access http: // localhost: 80 through a browser
By default, nginx is successfully started.
Welcome to nginx
3. nginx configuration folder
Conf:/usr/local/nginx/conf
Related commands
Start:
$sudo nginx #$sudo nginx -s start
Close:
$sudo nginx -s stop
Restart:
$sudo nginx -s reload
UWSGI
Installation tutorial: http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html
1. install
$sudo apt-get install uwsgi-plugin-python$sudo apt-get install uwsgi
Source code installation
Download: http://projects.unbit.it/uwsgi/wiki/WikiStart
Decompress, configure, compile, and install
$tar zxvf uwsgi-2.0.6.tar.gz$cd uwsgi-2.0.6$sudopython setup.py install
After the installation is complete, the end of uWSGI configration prompt is displayed.
Test uWSGI
Print version information
$uwsgi --version
Write the test script, test. py
defapplication(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World"]
Start uWSGI and use unused ports
$uwsgi--http:9090--wsgi-filetest.py
Enter the address in the browser to access
http://localhost:9090/
The browser outputs Hello World, indicating that the installation is successful.
Related commands
Start:
Execute the script
Close:
$killall-9 uwsgi$killall-s HUP /var/www/uwsgi $killall-s HUP /usr/local/bin/uwsgi
Django
Install dependency Library
$sudo apt-get install python2.7
Install Django
Download source code: https://www.djangoproject.com/download/
Decompress, configure, compile, and install
$tar zxvf Django-1.8.4.tar.gz$cd Django-1.8.4$sudopython setup.py install
Test Django
Print Django version information
$python>>import django>>django.VERSION(1,8,4, 'final', 0)
If the preceding figure is displayed, it indicates that Django is successfully installed.
Reference
Http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html
Http://segmentfault.com/q/1010000002523354
Http://www.nowamagic.net/academy/detail/1330331
Http://www.nowamagic.net/academy/detail/1330334
Http://www.linuxidc.com/Linux/2014-09/106928.htm
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above introduces Nginx + uWsgi + Django, including some content, and hope to be helpful to friends who are interested in PHP tutorials.