安装python36
yum install python36
下载pip3
wget https://bootstrap.pypa.io/get-pip.py
安装pip3
python36 get-pip.py
安装django
pip3 install django
运行django项目
python36 manage.py runserver
安装nginx
http://nginx.org/en/linux_packages.html#stable
新建文件:nginx.repo
vim /etc/yum.repos.d/nginx.repo
编辑文件,填入下面内容
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
启动nginx服务
service nginx start
配置nginx
/etc/nginx/conf.d/default.conf
server {
listen 443;
ssl on;
ssl_certificate /root/haima/ssl/server.crt;
ssl_certificate_key /root/haima/ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
root/haima/ssl/server.crt 和 /root/haima/ssl/server.key 是证书文件,可以到腾讯云上免费申请
重启nginx
service nginx restart
访问测试:
https://yourdomain