#腾讯云使用记录 ##运维开发 ###网络
| 端口号 | 端口作用 |
| 22 | sshd服务端口 |
| 53 | DNS解析端口 |
| 80 | web服务端口 |
##框架与步骤设计 ###物理与开发环境
| 配置种类 | 基础配置 | 详细信息 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 物理配置 | 腾讯云服务器 | 1核 | 2G内存 | 50G云硬盘 | 1Mbps带宽 | ||||||
| 操作系统 | Ubuntu Server | 18.04.1 LTS | GNU/Linux | 4.15.0-54-generic | x86_64 | ||||||
###docker框架
| Public</td> | Docker net [daniel-net]</td></tr> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vue-Nginx 前端管理服务器
| Apache-Django 后台管理服务器
| 数据库服务器
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BASE | vue-nginx | apache-django | redis | mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 各版本及实现功能 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V1.0.1 | 支持vue | 支持HCJS | 支持本地服务</tr> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V1.0.2 | 自动化部署 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 支持动静分离 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V1.0.3 | 支持HTTPS | 链接并调用数据库 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 组件结构 | ||
|---|---|---|
| Header | ||
| Main | Index | Sign\_in |
| Sign\_up | ||
| Footer |
| 基础镜像httpd:latest | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| 配置内容 | 执行命令 | ||||||||
| 更新apt-get | apt-get -y upgrade && apt-get update | ||||||||
| python3前导包 | apt-get install -y wgte gcc make build-essential | ||||||||
| apt-get install -y libncursesw5-dev libssl-dev | |||||||||
| apt-get install -y libgdbm-dev libc6-dev libsqlite3-dev | |||||||||
| apt-get install -y tk-dev libreadline-dev | |||||||||
| apache链接django包 | apt-get install -y libapache2-mod-wsgi-py3 | ||||||||
| 安装python3 | wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz | ||||||||
| tar xvf Python-3.6.8.tar.xz && cd Python-3.6.8 | |||||||||
| ./configure && make && make install | |||||||||
| rm -rf Python-3.6.8* | |||||||||
| ln -s /usr/local/bin/python3 /usr/local/bin/python | |||||||||
| ln -s /usr/local/bin/pip3 /usr/local/bin/pip | |||||||||
| pip安装django | pip install --upgrade pip | ||||||||
| pip install django pymysql django-redis | |||||||||
| 获取mod\_wsgi.so | cp mod_wsgi.so /usr/local/apache2/modules/ | ||||||||
| 生成镜像apache-django:BASE | |||||||||
httpd.conf修改内容 ```sh # 200行添加 LoadModule wsgi\_module modules/mod_swgi.so #末尾添加 ServerName 172.25.0.4:80 include conf/extra/autosort.conf ``` autosort.conf ```sh WSGISocketPrefix /var/run/wsgi <VirtualHost *:80> # ServerName sigboom.cn:80 # RewriteEngine On # RewriteRule ^/(d-media|media|examples|screenshots)($|(\/(.*))) /app/project/$0 [L] DocumentRoot /autosort DirectoryIndex html/index.html WSGIScriptAlias / /autosort/autosort/wsgi.py <Directory /autosort/autosort>
| 实现功能 | 命令 |
|---|---|
| 登录远程服务器 | ssh ${username}@${public_IP} |
| 命令均以git开头 | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| 命令 | 参数 | 参数意义 | 命令意义 | ||||||
| status | 查看本地仓库状态 | ||||||||
| add [File] | --all | 所有文件 | 将文件添加至缓存区 | ||||||
| commit | {-m [tag]} | 添加提交tag | 提交改变给本地仓库 | ||||||
| push | -f | 强制提交 | 将本地仓库推送至Github服务端 | ||||||
| -u [branch] | 推送到指定分支 默认[origin master] | ||||||||
| pull | 从Github服务端拉取最新版本 | ||||||||
| log | --oneline | 简化默认的输出 | 查看历史版本 | ||||||
| --pretty=[mode] | 自定义输出的信息 | git log --pretty=oneline | |||||||
| reset | --hard [git-ID] | 重置索引与工作树 | 回退到历史版本 | ||||||
| 命令 | 参数 | 参数意义 | 命令意义 |
|---|---|---|---|
| --version | 查看docker版本 | ||
| run [image_name] | -dit | -d | 在后台运行 | 从镜像启动容器 |
| --name [container] | 命名容器 | ||
| --net [net] | 定义容器网络 | ||
| --ip [IP] | 定义容器IP | ||
| -p [server_port]:[container_port] | 定义端口映射 | ||
| -v [server_path]:[container_path] | 定义挂载映射 | ||
| exec [container] [order] | -it | 以终端方式运行 | 在容器中运行命令 |
| search [image_name] | 查找镜像文件 | ||
| pull [image] | 拉取镜像文件 | ||
| rename [container] [new_container] | 容器重命名 | ||
| ps | -a | 查看所有状态 | 默认为运行的容器 |
| start | restart | stop | rm [container] | 启动 | 重启 | 停止 | 删除 容器 | ||
| rmi [image_name] | 删除镜像 | ||
| commit [container] [new_image] | -m [commit_msg] | 提交标签 | 从容器创建镜像 |
| -a [author] | 标记创建者 | ||
| tag [image_id] [image]:[image_tag] | 修改镜像标签 | ||
| save [image] | -o [tar_name].tar | 保存镜像的文件名 | 导出镜像 |
| 命令 | 参数 | 子参数 | 子参数意义 | 参数意义 |
|---|---|---|---|---|
| network | ls | 列出本机网络 | ||
| create [net] | -d bridge | host | none | 网络模式 | 创建网络 | |
| --subnet [IP_head]/[IP_room] | 设定网段 | |||
| connect [net] [container] | 将容器加入网络 | |||
| disconnect [net] [container] | 将容器断开网络 | |||
| inspect [net] | 查看网络内情况 | |||
| rm [net] | 删除网络 |
| 关键词 | 意义 |
|---|---|
| FROM [image] | 从该镜像生成镜像 |
| MAINTAINER [author [email]] | 为镜像添加作者(email) |
| COPY [File][container-path] | 从本机拷贝文件到容器 |
| 级别 | 类别 | 命令 | 参数 | 参数意义 | 目的 |
|---|---|---|---|---|---|
| 系统 | 登录 | mysql | -u[user] -p | 以[user]登录 | 登录数据库 |
| -h[IP] | 服务器IP默认localhost | ||||
| --port=[server_port] | 服务器端口默认3306 | ||||
| 用户管理 | create user '[user]' identified by '[passwd]'; | 创建用户[user] | |||
| grant all privileges on *.* to '[user]'@'[IP]' identified by '[passwd]' with grant option; | 授权[user]允许[IP]以[passwd]管理所有表并刷新 | ||||
| flush privileges; | |||||
| drop user [user]@[IP]; | 删除用户 | ||||
| 数据库 | show databases; | 打印数据库列表 | |||
| 数据库 | 表 | show tables; | 打印表格信息 | ||
| 表 | 插入 | insert | into [table] ({field...}) values ([value...]) | 无{field...}插入所有数据 | 指定列插入数据 |
| 删除 | delete | from [table] | 删除全部 | 删去表内信息 | </tr>|
| where [condition] | 约束条件 | ||||
| 修改 | update | [table] set ({field = value}..) | 修改field的值为value | 修改表格数据 | |
| where [condition] | 约束条件 | ||||
| 查询 | show columns | from [table] | 打印表头信息 | ||
| desc [table] | 打印表结构 | ||||
| select [key] [alias], [key] | from [table] | 打印表内信息 | |||
| where [condition] | 约束条件 | ||||
| 备注 | 必要参数 | ||||