linux:miniconda+python环境搭建

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

Ubuntu 安装和使用MySQL

MySQL+Navicat安装配置

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值