Ubuntu-nginx-uwsgi-flask

Source: Internet
Author: User
Tags virtual environment virtualenv

1. New service, first update.

Apt-get Update

2. Create a project path

Mkdir/www/web/cdms/home

3. Start the installation environment (install a bunch of things that can be summed up as one.)

Mkdir/www/soft

Apt-get Install python2.7

Apt-get Install Nginx

Apt-get Install Uwsgi Uwsgi-plugin-python python-virtualenv

Apt-get Install LIBSYBDB5

Apt-get Install Python-dev

Summarized as a (Apt-get python2.7 nginx uwsgi uwsgi-plugin-python python-virtualenv libsybdb5 Python-dev)

4. Installing pymssql

4.1 FreeTDS

wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz

Tar zxvf freetds-patched.tar.gz

./configure--prefix=/usr/local/freetds--with-tdsver=8.0--enable-msdblib

Make&make Install

4.2 Pip Install Pymssql

5. Create a virtual environment

cd/www/web/cdms/

Virtualenv env

CD env

. Bin/activate # (. Space bin/activate)

Pip Install flask

Pip Install pymssql

Install finish start write config file

1. Configure Nginx

Cd/etc/nginx/sites-enabled

Vim CDMs #创建

server {        listen       8081;        server_name 127.0.0.1;#               location/static {#                       alias/www/web/cdms/home/static;#               } location                /{                        Include Uwsgi_params;                        Uwsgi_pass 127.0.0.1:9001;                        Uwsgi_param uwsgi_pyhome/www/web/cdms/env;                        Uwsgi_param Uwsgi_chdir/www/web/cdms/home;                        Uwsgi_param Uwsgi_module run;                        Uwsgi_param uwsgi_callable app;                }}

2. Configure Uwsgi

Cd/etc/uwsgi/apps-available/apps-enabled

Vim Cdms.ini #创建

[uwsgi]plugins=pythonvhost=truesocket=127.0.0.1:9001processes=100

  

Chown-r Www-data:www-data CDMs

Www-data Permissions for directory-for Security

Ubuntu-nginx-uwsgi-flask

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.