Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
chendelin1982 committed May 11, 2024
1 parent e03c167 commit e24812a
Show file tree
Hide file tree
Showing 49 changed files with 217 additions and 272 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/admin/backup/websoft9.md
Expand Up @@ -29,7 +29,7 @@ Websoft9 以及应用的可视化 Volumes 备份(回复)功能,主要通
- 存储路径选择 **本地文件夹或磁盘**,文件夹路径设置为: 【Computer】>【backups】
备份会直接保存到服务器目录 */data/websoft9/vl_backups*(它是 Duplicati 容器挂载的备份目录)

![](https://libs.websoft9.com/Websoft9/DocsPicture/zh/websoft9/websoft9-duplicati-setlocalsource.png)
![](./assets/websoft9-duplicati-setlocalsource.png)


- 存储路径选择 **SFTP**,支持保存到 Websoft9 所在的服务器或第三方服务器
Expand All @@ -39,7 +39,7 @@ Websoft9 以及应用的可视化 Volumes 备份(回复)功能,主要通

5. 设置源数据,即备份对象。请点击【计算机】>【Source】列出可备份的 Volumes

![](https://libs.websoft9.com/Websoft9/DocsPicture/zh/websoft9/websoft9-duplicati-setsource.png)
![](./assets/websoft9-duplicati-setsource.png)

- 以 websoft9_ 开头的文件夹,是 Websoft9 自身的数据目录
- 其他文件夹是应用目录
Expand All @@ -50,7 +50,7 @@ Websoft9 以及应用的可视化 Volumes 备份(回复)功能,主要通
7. 设置其他选型

8. 设置完成后,可立即运行备份
![](https://libs.websoft9.com/Websoft9/DocsPicture/zh/websoft9/websoft9-duplicati-editbkfile.png)
![](./assets/websoft9-duplicati-editbkfile.png)

### 恢复

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/admin/security/insertcode.md
Expand Up @@ -64,7 +64,7 @@ slug: /admin/security_insertcode
3. 登录WordPress后台,安装安全插件[Wordfence Scan Enabled](https://wordpress.org/plugins/wordfence/)

5. 运行 Wordfence Scan Enabled,启动网站健康检查
![](https://libs.websoft9.com/Websoft9/DocsPicture/en/wordpress/wordpress-wordfence-websoft9.png)
![](./assets/wordpress-wordfence-websoft9.png)

4. 对于【Critical】标记的结果,手工一一处理

Expand Down
Binary file added docs/admin/server/assets/ecs-cannotconnect.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
187 changes: 18 additions & 169 deletions docs/admin/server/linux.md
Expand Up @@ -9,7 +9,7 @@ slug: /linux

## 指南

### Linux 系统账号{#osaccount}
### 系统账号{#osaccount}

不同的云平台操作系统账号是不一样的,有的云平台可以在创建服务器时自定义用户名称,有的是固定用户名`root`

Expand All @@ -25,172 +25,24 @@ slug: /linux

常见 Linux 连接方式包括:

* SSH 连接
* SFTP 连接
* RDP 连接
* VNC 连接
* Telnet 连接
* SSH 和 SFTP 连接系统
* RDP和 VNC 连接桌面

而连接的工具类型主要是两种
连接的工具有两种类型

- 本地电脑客户端,例如:WinSCP, Putty, Xshell, Tabby, MobaXterm 等
- 在线 Web 客户端:各大云平台均提供的 Web 版在线连接工具
- 本地电脑客户端,例如:Terminus, WinSCP, Putty, Xshell, Tabby, MobaXterm 等
- 在线 Web 客户端:云平台和 Websoft9 控制台均提供的 Web 版在线连接工具

下面以本地客户端 WinSCP(它具备**可视化管理文件**以及运行命令的能力) 这款 SFTP 工具为例,详细说明 SFTP 和 SSH 的使用。

#### 配置 WinSCP
### 增设数据磁盘

1. 下载 [WinSCP](https://winscp.net/) 并安装。启动后,新建一个连接
2. 设置验证密码:针对 **密码验证和秘钥对** 两种验证方式分别说明:
- 密码验证方式设置(最常见的方式)
![密码验证方式](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/winscp-newsite.png)
- 秘钥对验证方式设置
![秘钥对验证方式](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/winscp-secrets-websoft9.png)
3. 验证方式设置好之后,点击"登录"。登录中过程中,系统提示您是否保存登录信息,选择"是"
4. 成功连接后的界面
![WinSCP管理界面](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/websoft9-winscp-success.png)
Websoft9 多应用托管平台由于运行的应用较多,用户可能需要增加数据盘以扩展存储。

#### 管理文件
增加数据磁盘的主要步骤:

WinSCP 通过拖拽,就可以方便上传下载文件,可以对文件(夹)可以对进行多种设置与操作

1. 右键单击服务器上一个文件或文件夹,可以对云服务器进行多种操作
![管理文件](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/websoft9-winscp-youjian.png)

2. 以修改文件权限为例的相关界面如下

![管理文件](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/websoft9-winscp-quanxian.png)

#### 运行命令

WinSCP 自带命令运行的终端,对于初学者来说简单实用:

1. WinSCP登录到服务器,点击菜单来的命令窗口图标(快捷键Ctrl+T也可以)
![命令行工具](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/winscp-ucmd-websoft9.png)

2. 在弹出的命令运行窗口执行命令(每次一条命令),以查询内存使用为例,运行命令 `free -m`
![命令行工具](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/wincp-showmemory-websoft9.png)

#### 集成 Putty

专业的 SSH 工具 Putty 虽然可以单独运行,但把 Putty 集成到 WinSCP 上使用更加方便。

1. 依次打开:WinSCP-选项-集成-应用程序,定位到本地 Putty 路径后保存即成功集成
![命令行工具](http://libs.websoft9.com/Websoft9/DocsPicture/zh/winscp/websoft9-winscp-putty.png)

2. 测试集成:通过 WinSCP 的窗口快捷方式打开 Putty


### 初始化数据磁盘

初始化数据磁盘主要分为三个步骤:

* 磁盘分区
* 磁盘初始化
* 磁盘挂载

### 自动关机设置

需求:每天晚上20:00服务器自动关机

```
[Unit]
Description=shutdown linux service
[Service]
Type=oneshot
ExecStart=/usr/sbin/shutdown -h 20:00
[Install]
WantedBy=multi-user.target
```


### 编写 Systemd 系统服务

服务(service) 本质就是进程,运行在后台,通常都会监听某个端口,等待其它程序的请求,比如(mysql , sshd 防火墙等),因此我们又称为守护进程,是 Linux 中非常重要的知识点。

一般通过下面的格式来管理服务:
```
systemctl 服务名 [start | stop | restart | reload | status]
```

那服务是如何创建的呢?在Linux技术里面编写这种服务也被称之为编写Systemd 的 Unit 文件

以 Websoft9 提供的 Redmine 自动化项目为例,下面描述完整的服务创建过程:

1. 编辑好[redmine.service](https://github.com/Websoft9/ansible-redmine/blob/master/roles/redmine/files/redmine.service)文件
```
[Unit]
Description=Redmine
After=nginx.service
[Service]
Environment=RAILS_ENV=production
Type=simple
WorkingDirectory=/data/wwwroot/redmine
ExecStart=/usr/local/bin/puma -b tcp://127.0.0.1:9292 -e production
User=redmine
[Install]
WantedBy=multi-user.target
```

2. 将服务文件放入路径:*/etc/systemd/system*

3. 启动并设置开机启动

4. 测试服务的可用性
···
systemctl restart redmine
systemctl stop redmine
···

附:通配符含义

| 替换符 | 含义 |
| ------ | ------------------------------------------------------------ |
| "`%b`" | 系统的"Boot ID"字符串。参见 [random(4)](http://man7.org/linux/man-pages/man4/random.4.html) 手册。 |
| "`%H`" | 系统的主机名(hostname) |
| "`%m`" | 系统的"Machine ID"字符串。参见 [machine-id(5)](http://www.jinbuguo.com/systemd/machine-id.html#) 手册。 |
| "`%T`" | 临时文件目录。也就是 `/tmp` 或 "`$TMPDIR`", "`$TEMP`", "`$TMP`" 之一(若已设置) |
| "`%v`" | 内核版本(**uname -r** 的输出) |
| "`%V`" | 存放大体积临时文件以及持久临时文件的目录。也就是 `/var/tmp` 或 "`$TMPDIR`", "`$TEMP`", "`$TMP`" 之一(若已设置) |
| "`%%`" | 百分号自身(%)。使用"%%"表示一个真正的"%"字符。 |

### 设置一次性任务

Systemd 可以用于处理开机一次性运行脚本。只需将 Tpye=oneshot 即可

```
[Unit]
Description=Switch-off Touchpad
[Service]
Type=oneshot
ExecStart=/usr/bin/touchpad-off
[Install]
WantedBy=multi-user.target
```


### 设置计划任务

Cron是一个Linux下的定时执行工具,可以在无需人工干预的情况下定时地运行任务task。

1. 安装Crontab
```
yum install vixie-cron
yum install crontabs
```
2. 编写计划任务脚本:可通过[在线 Crontab 生成器](https://crontab-generator.org/),简化脚本的编写
```
4 * * * * echo "hello" >/dev/null 2>&1
```
3. 将脚本插入Cron配置文件:*/etc/crontab*

### 临时目录清理策略

以 CentOS 为例,为 /tmp, /var/tmp 临时目录清理策略,只需修改 */usr/lib/tmpfiles.d/tmp.conf*
* 购买数据磁盘
* 磁盘分区与初始化
* 磁盘设置为系统的挂载点


### 使用 Linux 桌面
Expand Down Expand Up @@ -229,9 +81,11 @@ Cron是一个Linux下的定时执行工具,可以在无需人工干预的情

### 软件仓库

Linux 操作系统都提供了一个集中的软件包管理机制,即搜索、安装和管理软件包。 Linux 软件包的基本组成部分通常有:共享库、应用程序(二进制)、服务和文档。从另外一个角度看,包文件通常包含编译好的二进制文件和其它资源组成的:软件、安装脚本、元数据及其所需的依赖列表。
Linux 操作系统都提供了一个集中的软件包管理机制--软件仓库。

![](https://libs.websoft9.com/Websoft9/DocsPicture/zh/linux/linux-rpms-websoft9.png)
Linux 软件包由:共享库、应用程序(二进制)、服务和文档组成及其所需的依赖列表。

![](./assets/linux-rpms-websoft9.png)

下面我们列出全球比较流行的仓库:

Expand Down Expand Up @@ -278,7 +132,7 @@ timedatectl status
The Linux kernel can reset the system if serious problems are detected. This can be implemented via special watchdog hardware, or via a slightly less reliable software-only watchdog inside the kernel.
```

因此,解决重启的问题,主要还是要找到 CPU 100% 的原因。当然,也可以修改 WatchDog 的配置以降低它通过重启解决问题的权重。
重启是果,CPU 100% 是根本原因。当然,也可以修改 WatchDog 的配置以降低它通过重启解决问题的权重。


#### 磁盘已满,需要清理?
Expand All @@ -301,9 +155,4 @@ The Linux kernel can reset the system if serious problems are detected. This can

下图显示了无法连接云服务器的主要原因分类及出现概率,按照对应的原因进行排查:

![](https://libs.websoft9.com/Websoft9/DocsPicture/zh/common/ecs-cannotconnect.jpeg)

#### 连接 SFTP,出现 Disconnected...publickey{#sftpnokey}

错误原因:服务器初始化的适合,启用的是密钥对登录方式(密码登录会不开启)
解决方案:设置 WinSCP 为秘钥对登录 或 云控制台更改登录凭证方式
![](./assets/ecs-cannotconnect.jpeg)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/admin/settings/system.md
Expand Up @@ -15,7 +15,7 @@ slug: /settings/system

全局域名非常实用,只需在此处做一次域名解析和绑定,即可被所有应用使用。

![设置全局域名](https://libs.websoft9.com/Websoft9/DocsPicture/zh/websoft9/websoft9-settings-globaldomain.png)
![设置全局域名](./assets/websoft9-settings-globaldomain.png)

详情参考:[设置应用的域名-全局域名](../guide/appsetdomain#global-domain)

Expand Down
10 changes: 1 addition & 9 deletions docs/admin/upgrade/os.md
Expand Up @@ -5,8 +5,6 @@ slug: /upgrade/os

# 操作系统更新

## Linux 更新{#linux}

Linux服务器以及组件的更新,只需要运行一条命令即可完成:

```
Expand All @@ -17,10 +15,4 @@ sudo yum update -y
apt update && apt upgrade -y
```

> 建议用户将更新命令设置成**计划任务**,实现自动升级。
## Windows 更新{#windows}

Windows服务器的更新与本地电脑类似,手动找到更新管理程序,设置自动下载自动更新即可。

![](https://libs.websoft9.com/Websoft9/DocsPicture/zh/windows/windows-upgrade-websoft9.png)
> 建议用户将更新命令设置成**计划任务**,实现自动升级。
Binary file added docs/business/assets/websoft9-app-hosting.pdf
Binary file not shown.

0 comments on commit e24812a

Please sign in to comment.