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