ubuntu-nginx-uwsgi-flask
1.新服,先更新一下.
apt-get update
2.创建项目路径
mkdir /www/web/cdms/home
3.开始安装环境(安装一堆东西,可以总结为一条.)
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
总结为一条 ( apt-get python2.7 nginx uwsgi uwsgi-plugin-python python-virtualenv libsybdb5 python-dev )
4.安装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. 创建虚拟环境
cd /www/web/cdms/
virtualenv env
cd env
. bin/activate #(. 空格 bin/activate )
pip install flask
pip install pymssql
安装完成 开始写配置文件
1. 配置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. 配置uwsgi
cd /etc/uwsgi/apps-available/apps-enabled
vim cdms.ini #创建
[uwsgi] plugins=python vhost=true socket=127.0.0.1:9001 processes=100
chown -R www-data:www-data cdms
给目录www-data权限- for安全
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。