mirror of
https://github.com/LamGC/quickly-conf-sshd.git
synced 2025-04-29 22:27:32 +00:00
更新 Readme.
This commit is contained in:
parent
75501d82a1
commit
b294243d6d
51
README.md
51
README.md
@ -4,9 +4,54 @@ Quickly install SSH into the server.
|
|||||||
## Usage
|
## Usage
|
||||||
执行命令:
|
执行命令:
|
||||||
```bash
|
```bash
|
||||||
curl -s https://lamgc.github.io/quickly-conf-sshd/conf-sshd.sh | bash -s -- -c
|
curl -s https://ssh.lamgc.me | bash -s -- -c
|
||||||
```
|
```
|
||||||
如果不希望自动更新密钥,可以执行:
|
如果不希望自动更新密钥,可以执行:
|
||||||
```bash
|
```bash
|
||||||
curl -s https://lamgc.github.io/quickly-conf-sshd/conf-sshd.sh | bash -s
|
curl -s https://ssh.lamgc.me | bash -s
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Install
|
||||||
|
### Configuration
|
||||||
|
先 Fork 本仓库,Fork 后在仓库设置中启用 Github Pages,分支指向 main 分支,目录为仓库根目录。
|
||||||
|
配置好后将仓库克隆到本地,然后修改 `cf-worker/src/index.js` 中的前五个变量:
|
||||||
|
```javascript
|
||||||
|
// 改成你自己的 Github 用户名,注意是登录 Github 的那个用户名.
|
||||||
|
const githubUserName = "LamGC";
|
||||||
|
// 改成你 Fork 后的仓库名,记得要开启 Github Pages 功能.
|
||||||
|
const githubInstSshProjectName = "quickly-conf-sshd";
|
||||||
|
// 如果可以,建议在此设置备用的 SSH 公钥, 以防 Github 无法使用.
|
||||||
|
const backupSshKeys = ``;
|
||||||
|
// Worker 的访问地址, 如果不填的话默认为请求的地址, 填了就会用这里的地址(要去 Worker 的触发器那绑定, 否则无效).
|
||||||
|
const defaultBaseUrl = "";
|
||||||
|
// Cron 表达式, 默认 1 天执行一次更新.
|
||||||
|
const cronExpression = "0 0 * * *";
|
||||||
|
```
|
||||||
|
|
||||||
|
### Use Wrangler
|
||||||
|
如果你安装了 Cloudflare 的 Wrangler,可以直接在 `cf-worker` 目录中执行:
|
||||||
|
```bash
|
||||||
|
wrangler publish
|
||||||
|
```
|
||||||
|
执行后将会自动创建 Worker 并上传 worker js 代码,Worker 的名字是 `quickly-conf-ssh-worker`。
|
||||||
|
|
||||||
|
### Manual Install
|
||||||
|
如果你没有安装 Wrangler,那就手动在 Cloudflare Workers 中新建一个 Worker,名字你喜欢就好(也可以使用 `quickly-conf-ssh-worker`),选择 HTTP 处理程序,然后下一步;
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
创建完成后点击 Worker 名称右边的**快速编辑**,将 `cf-worker/src/index.js` 中的内容复制到编辑框中,把原本的代码覆盖掉,然后保存;
|
||||||
|

|
||||||
|
|
||||||
|
保存后需要访问一下 Worker,检查是否有误(如果不检查仔细,把其他人的 SSH 密钥设置到服务器里了,那就寄咯):
|
||||||
|
- 直接访问 Worker 地址,看看是否能跳转到你 Fork 的仓库中(地址栏显示了 `https://{你的 Github 用户名}.github.io/{Fork的仓库名}/`);
|
||||||
|
- 访问 `{Worker地址}/ssh.keys`,应该显示你的在 Github 设置了的所有 SSH 公钥,如果是空的或者不是你的密钥,那就检查一下是不是 Github 用户名填错了;
|
||||||
|
- 访问 `{Worker地址}/script.sh`,应该返回一个脚本,脚本开头的配置应与你在 Worker 开头的有关配置一致。
|
||||||
|
|
||||||
|
检查无误后就算安装完成了。
|
||||||
|
|
||||||
|
### (可选)使用自定义域名
|
||||||
|
在 Worker 详情中,点击“触发器”,然后点击“添加自定义域”,按照提示输入已添加在 Cloudflare 中的域名即可。
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
BIN
docs/Create-a-new-worker.png
Normal file
BIN
docs/Create-a-new-worker.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
docs/add-custom-domain.png
Normal file
BIN
docs/add-custom-domain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
docs/added-custom-domain.png
Normal file
BIN
docs/added-custom-domain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
docs/copy-js-code-to-worker.png
Normal file
BIN
docs/copy-js-code-to-worker.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
BIN
docs/input-custom-domain.png
Normal file
BIN
docs/input-custom-domain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Loading…
Reference in New Issue
Block a user