简介
阿里云国际版多用户多账号管理系统,有需要的话,可以联系我,下面是安装教程。>
环境要求
CentOS 7.X
Python 3.6+
Nginx
环境安装
1,yum install -y python36 python36-devel # 安装python36 2,cp /usr/bin/python3.6 /usr/bin/python3 # 修改python3指向 3,cd /tmp;wget https://bootstrap.pypa.io/get-pip.py –O get-pip.py ; # 下载 pip 4,python3 get-pip.py # 安装 pip3 5,yum install –y nginx # 安装nginx
环境到这边就已经安装完成了。
程序安装
1,mkdir /home/python/aliyun # 创建程序目录。 2,解压程序到 /home/python/aliyun 。 3,pip3 install –r requirements # 安装所需要的python库 4,python3 manage.py makemigrations app # 生成创建数据库脚本 5,python3 manage.py migrate # 创建数据库 6,python3 manage.py runserver 0.0.0.0:889
使用IP和端口在浏览器上面打开,如果都没报错的话说明程序已经安装完成。
管理员账号
1,首次登录的账号密码就是管理员权限(无需注册) 2,python manage.py createsuperuser # 使用命令创建管理员账号
二选一就可以。
Nginx 反代配置
在/etc/nginx/conf.d/ 目录创建 aliyun.conf ,将以下文件修改后 保存到 aliyun.conf
server { listen 80; #listen [::]:80; rewrite ^(.*)$ https://$host$1 permanent; server_name cs.hengyii.com ; } server { listen 443 ssl http2; #listen [::]:443 ssl http2; server_name cs.hengyii.com ; index index.html index.htm index.php default.html default.htm default.php; root /home/python/aliyun; ssl on; ssl_certificate /home/ssl/my.hengyii.com.crt; ssl_certificate_key /home/ssl/my.hengyii.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5"; ssl_session_cache builtin:1000 shared:SSL:10m; # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048 # ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem; location /static/ { root /home/python/aliyun/; } location / { proxy_set_header Accept-Encoding ''; proxy_set_header Host $http_host; proxy_set_header Referer $http_referer; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:889; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /home/wwwlogs/cs.hengyii.com.log; }
程序后台运行
1,使用screen 打开一个远程会话,然后执行 python3 manage.py runserver 127.0.0.1:889 2,nohup python3 /home/python/aliyun/manage.py runserver 127.0.0.1:889 >> /var/log/aliyun.log 2>&1 &
配置自动任务
命令 crontab -e
*/5 * * * * python3 /home/python/aliyun/crontab.py UpdateServer 2>&1 & # 5分钟更新一次服务器 00 01 * * * python3 /home/python/aliyun/crontab.py UpdateTraffic 2>&1 & # 凌晨统计流量 00 01 * * * python3 /home/python/aliyun/crontab.py ExpiredNotice 2>&1 & # 检测到期前4天的机器, 并发邮件通知用户 00 * * * * python3 /home/python/aliyun/crontab.py CheckInstance 2>&1 & # 每小时检测一次超过流量的机器
转载请注明:分享吧 » 阿里云控制面板安装教程