From e3628fc62d900c66886514419564a9eab0ba5017 Mon Sep 17 00:00:00 2001 From: buyfakett Date: Sat, 12 Oct 2024 17:45:12 +0800 Subject: [PATCH] doc: update docker.md & linux-command.md & nginx.md (#838) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc: update linux-command.md * 增加代理构建 * 删除上次提交多余 --- docs/docker.md | 1 + docs/linux-command.md | 18 ++++++++++++++++++ docs/nginx.md | 38 -------------------------------------- 3 files changed, 19 insertions(+), 38 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index c1dfea12234..22223164ff1 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -163,6 +163,7 @@ $ docker build - < Dockerfile $ docker build - < context.tar.gz $ docker build -t eon/nginx-server . $ docker build -f myOtherDockerfile . +$ docker build --build-arg https_proxy=127.0.0.1:8088 # 使用http代理构建 $ curl example.com/remote/Dockerfile | docker build -f - . $ docker save -o <保存路径>/myimage.tar myimage:latest # 导出 $ docker load -i <路径>/myimage.tar # 导入 diff --git a/docs/linux-command.md b/docs/linux-command.md index 1d31db904bd..9850adc3a7e 100644 --- a/docs/linux-command.md +++ b/docs/linux-command.md @@ -24,6 +24,7 @@ Linux 命令速查表 **`w`** | 显示系统中当前登录的用户 **`whoami`** | 显示您的登录身份 **`finger username`** | 显示有关用户的信息 +**`sed -ri 's/.*swap.*/#&/' /etc/fstab && swapoff -a`** | 关闭swap ### 硬件 @@ -332,6 +333,23 @@ Linux 命令速查表 `Ctrl`+`N` (Down) | 下一条命令 +技巧 +--- + +### linux技巧 + + + :--- | :--- +:----------------------------------------------| :--- + **`du -h / \| sort -rh \| head -20`** | 最大20个文件 + **`grep -Ev '^\s*($\|#\|;)' example.conf`** | 查看去掉注释和空行 + **`echo \| passwd root --stdin`** | 单行改密码 + **`find /data/app/tmp -mtime +30 -name "*.flv" -exec rm -Rf {} \;`** | 删除30天前文件 + **`for file in $(ls); do sed -i 's/nmg/sz/g' "$file"; done`** | 当前目录修改字符串 + **`ssh -NfR remote_port:localhost:local_port user@remote_server`** | ssh代理 + **`find . -wholename "*.sh" -exec dos2unix {} \;`** | 修复脚本格式错误 + + 另见 --- diff --git a/docs/nginx.md b/docs/nginx.md index d5bc0f11f13..086cffec812 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -975,44 +975,6 @@ server { } ``` -### 流量镜像配置 - - -```nginx -server { - listen 80; - server_name 192.168.1.1; - - location = /mirror1 { - internal; - #### address1 #### - proxy_set_header Host mirror1.com; - proxy_pass http://127.0.0.1:8008/api/service/list; - } - - location = /mirror2 { - internal; - #### address2 #### - proxy_set_header Host mirror2.com; - proxy_pass http://127.0.0.1:8009/api/service/list; - } - - # 只转发这个接口 - location /api/service/list { - access_log /data/logs/nginx/json_test_to_mirror.log json; - mirror /mirror1; - mirror /mirror2; - proxy_pass http://127.0.0.1:8007; - } - - location / { - access_log /data/logs/nginx/json_test.log json; - proxy_pass http://192.168.1.1:8007; - } - -} -``` - 另见 ---