1.
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
2.
bash Miniconda3-latest-Linux-x86_64.sh
3.
source ~/.bashrc
#conda,这是把conda的环境加入系统的环境变量
export conda=/root/miniconda3
export PATH=$PATH:$conda/bin
# 这一步是系统进入conda的默认base环境
source activate
4.
conda update -n base -c defaults conda
conda deactivate
conda update conda
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
5.安装nginx
sudo apt-get install nginx
验证是否能成功启动;
root@zky:~/programs# /etc/init.d/nginx start
Starting nginx (via systemctl): nginx.service.
默认项目文件位置:
nginx.conf:
\etc\nginx\nginx.conf
default(配置项)
\etc\nginx\sites-available\default
default中规定的默认html位置:
\var\www\html\index.html
default:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm test.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# 请求转发到gunicorn服务器
proxy_pass http://127.0.0.1:5000;
# 请求转发到多个gunicorn服务器
# proxy_pass http://flask;
# 设置请求头,并将头信息传递给服务器端
proxy_set_header Host $host;
# 设置请求头,传递原始请求ip给 gunicorn 服务器
proxy_set_header X-Real-IP $remote_addr;
}
}
需同时后台启动gunicorn:
gunicorn -w 4 -b 127.0.0.1:5000 t1:app -D
ti为py名 app表示py内绑定的程序名
重启:
/etc/init.d/nginx stop
/etc/init.d/nginx start
#查看端口使用
sudo netstat -tulnp | grep :5000
cd ../pyitems/ly_items
6.使用mysqld