Ubuntu Nginx Uwsgi Django Preliminary interview

Source: Internet
Author: User
Tags fpm

/************************************************************************************** * Ubuntu Nginx Uwsgi Django First Interview * Description: * Recently planned to build a data collection site through Python, do a build test. * 2016-8-5 Shenzhen Nanshan Ping Shan village Zengjianfeng ****************************** *******************************************************/First, reference article:1. Build nginx+uwsgi+python+ under UbuntuMySQL Development environment http://blog.csdn.net/hchuchuan/article/details/49718521    2to deploy Django HTTP on Ubuntu based on Nginx and Uwsgi://www.jianshu.com/p/e6ff4a28ab5a    3. Install Uwsgi1.2.5via pip http://Askubuntu.com/questions/182313/install-uwsgi-1-2-5-via-pip    4. How to Install the Django Web Framework on Ubuntu14.04https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-14-04    5. nginx+Uwsgi Getting Started with http://my.oschina.net/u/877567/blog/201577ii. Django directory structure: [email protected]:~/website$ pwd/home/zengjf/website [email protected]:~/website$ tree. └──mysite├──manage.py└──mysite├──__init__.py├──__init__.pyc├──se ttings.py├──settings.pyc├──urls.py├──urls.pyc└──wsgi.py2Directories,8files [email protected]:~/website$ Three, nginx configuration: [email protected]:/etc/nginx/sites-available# pwd/etc/nginx/sites-available [email protected]:/etc/nginx/sites-available# Catdefault# You could add here your # server {# ... #} # statements forEach of yourVirtualHosts to ThisFile # # # should look at the following URL's in order to grasp a solid understanding# Nginx configuration Filesinchorder to fully unleash the power of Nginx. # http://Wiki.nginx.org/pitfalls# http://Wiki.nginx.org/quickstart# http://wiki.nginx.org/configuration# # Generally, you'll want to move Thisfile somewhere, and start with a clean # file but keep ThisAround forReference. Or just disableinchsites-enabled. # # #/usr/share/doc/nginx-doc/examples/ forMore detailed examples. # # server {Listen8000Default_server; Listen [::]:8000Default_server ipv6only=On ; Root/home/zengjf/website/MySite;            Index index.html index.htm; # Make site accessible fromhttp//localhost/server_name localhost; Location/{# First attempt to serve request asfile, then # asDirectory, then fall back to displaying a404. # try_files $uri $uri/ =404;            Include Uwsgi_params; Uwsgi_pass127.0.0.1:9091; #必须和uwsgi中的设置一致 # Uncomment to enable Naxsi on ThisLocation # include/etc/nginx/Naxsi.rules} # only forNginx-naxsi used with nginx-naxsi-Ui:process denied requests #location/requestdenied {# Proxy_pass http://127.0.0.1:8080; #} #error_page404/404. html; # REDIRECT Server error pages to theStaticPage/50x.html # #error_page - 502 503 504/50x.html; #location= /50x.html {# root/usr/share/nginx/html; #} # Pass the PHP scripts to FastCGI server listening on127.0.0.1:9000# #location~\.php$ {# fastcgi_split_path_info^ (. +\.php) (/.+)$; # # note:you should have"cgi.fix_pathinfo = 0;" inchphp.ini # # # with PHP5-CGI alone: # Fastcgi_pass127.0.0.1:9000; # with PHP5-fpm: # fastcgi_pass UNIX:/var/run/php5-Fpm.sock;        # Fastcgi_index index.php;        # include Fastcgi_params; #} # Deny access to. htaccess files,ifApache's Document Root# concurs with Nginx'S One# #location~ /\.ht {# deny all; #}} # anotherVirtualHostusingMix of ip-, name-, and port-based configuration # #server {# listen8000; # Listen Somename:8080;    # server_name somename alias Another.alias;    # root HTML;    # index index.html index.htm; # # Location/{# try_files $uri $uri/ =404; #} #} # HTTPS Server # #server {# listen443;    # server_name localhost;    # # root HTML;    # index index.html index.htm;    # # SSL on;    # ssl_certificate Cert.pem;    # Ssl_certificate_key Cert.key;    # # Ssl_session_timeout 5m; # # Ssl_protocols SSLv3 TLSv1 TLSv1.1TLSv1.2; # ssl_ciphers"high:!anull:! MD5 or high:!anull:! Md5:!3des";    # ssl_prefer_server_ciphers on; # # Location/{# try_files $uri $uri/ =404; #} #} [email protected]:/etc/nginx/sites-available# Four, run UWSGI command: [email protected]:/home/zengjf/website# Uwsgi--socket127.0.0.1:9091--chdir/home/zengjf/website/mysite--wsgi-file mysite/wsgi.py--master--processes2--threads2Starting Uwsgi2.0.13.1(64bit) on [Fri5  +: -: -  .] ***compiled with version:4.8.4OnGenevaAugust .  +: A: theOs:linux-3.16.0- --generic # +~14.04.1-ubuntu SMP Thu Jan the  -: +: -Utc -nodename:zengjf machine:x86_64 clock Source:unix pcre JIT disabled detected number of CPU cores: 
    2Current working directory:/home/zengjf/website detected binary path:/usr/local/bin/Uwsgi Uwsgi Running asRoot, you can use--uid/--gid/--chroot OptionsWarning:you is running Uwsgi asRoot!!! (Use the--UID flag) * * *chdir () to/home/zengjf/website/MySite Your processes number limit is 15313your memory page size is 4096bytes Detected max file descriptor number:1024x768    LockEngine:pthread robust mutexes ThunderLock: Disabled (You can enable it with--thunder-Lock) UWSGI Socket0Bound to TCP address127.0.0.1:9091Fd3Python Version:2.7.6(default, June A  -, -: on: -) [GCC4.8.2] Python main interpreter initialized at0x24ae640Python threads support enabled your server socket Listen backlog isLimited to -Connections Your Mercy forGraceful operations on workers is  -seconds Mapped249168Bytes (243KB) for 4coresOperational mode:preforking+threaded * * *WSGI App0(mountpoint="') Readyinch 0seconds on Interpreter0x24ae640Pid:4120(defaultapp)Uwsgi isRunninginchMultiple Interpreter mode * * *spawned UWSGI master process (PID:4120) spawned UWSGI worker1(PID:4121, Cores:2) spawned UWSGI worker2(PID:4122, Cores:2)    

Ubuntu Nginx Uwsgi Django Preliminary interview

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.