diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093045210.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093045210.png" index 1238471..2c37941 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093045210.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093045210.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093341959.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093341959.png" index 6d917d6..9d1fd95 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093341959.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093341959.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093732264.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093732264.png" index eb6a632..490ed4b 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093732264.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093732264.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093934096.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093934096.png" index 4b0f96e..64a4bda 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093934096.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093934096.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093954383.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093954383.png" index a8e16c7..a25124d 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093954383.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513093954383.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094013505.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094013505.png" index 2cc2cb7..0d59f2f 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094013505.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094013505.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094214889.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094214889.png" index 5b21ecf..7d877b9 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094214889.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094214889.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094228729.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094228729.png" index 6bf44e2..cd89d5e 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094228729.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094228729.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094320097.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094320097.png" index db1635c..4daaddf 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094320097.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094320097.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094643815.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094643815.png" index 0a6f0c1..7f84bba 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094643815.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094643815.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094748529.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094748529.png" index 94a497d..914e00f 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094748529.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513094748529.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095055192.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095055192.png" index aa62943..568419d 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095055192.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095055192.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095140505.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095140505.png" index 32f1c2f..5c9da39 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095140505.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095140505.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095212339.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095212339.png" index 1421636..41b4df1 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095212339.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095212339.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095237808.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095237808.png" index 30832e3..1b10774 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095237808.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095237808.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095332738.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095332738.png" index 169da8f..0e9f865 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095332738.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095332738.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095640820.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095640820.png" index 336c371..2809681 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095640820.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095640820.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095652519.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095652519.png" index bb5e5ba..7b65a38 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095652519.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095652519.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095752726.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095752726.png" index 2437be6..1bc516b 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095752726.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095752726.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095822054.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095822054.png" index 4a04b96..833c25a 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095822054.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095822054.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095942064.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095942064.png" index c483dab..942b110 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095942064.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513095942064.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100016239.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100016239.png" index bb9f663..828f55d 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100016239.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100016239.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100103791.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100103791.png" index c6bf40c..e5e6d8e 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100103791.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100103791.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100129679.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100129679.png" index 8eacd97..55e9beb 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100129679.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100129679.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100419015.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100419015.png" index 4ce4010..5d3eb76 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100419015.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100419015.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100509093.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100509093.png" index 907e797..9cd0360 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100509093.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100509093.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100606627.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100606627.png" index 4fae60f..f1a6a69 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100606627.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100606627.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100630996.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100630996.png" index 5966280..19973c1 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100630996.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100630996.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100825116.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100825116.png" index d7c0781..a597fdb 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100825116.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513100825116.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101358650.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101358650.png" index 6a9b3db..559826e 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101358650.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101358650.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101431944.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101431944.png" index d9dcace..fa5d9bf 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101431944.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101431944.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101457691.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101457691.png" index bb96000..1ebd9dd 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101457691.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101457691.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101730325.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101730325.png" index 3b0fbd9..1eefb2d 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101730325.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101730325.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101816443.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101816443.png" index 5946cb0..5007466 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101816443.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101816443.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101839833.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101839833.png" index 0626b82..36fbfcd 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101839833.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101839833.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101902870.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101902870.png" index 71a6898..08eda1f 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101902870.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101902870.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101910710.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101910710.png" index bcd0a7c..6288b74 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101910710.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101910710.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101941108.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101941108.png" index f269155..4f5d65b 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101941108.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513101941108.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102015626.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102015626.png" index 0784c0d..e62ffd3 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102015626.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102015626.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102242848.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102242848.png" index 80aaaa9..7c6efde 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102242848.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102242848.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102317624.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102317624.png" index 6f9dcbe..18c3c83 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102317624.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102317624.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102349111.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102349111.png" index 10c1b9f..9b53055 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102349111.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102349111.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102407557.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102407557.png" index 6fa2ba2..1045360 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102407557.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102407557.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102417620.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102417620.png" index fc3db30..9963f04 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102417620.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102417620.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102440868.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102440868.png" index 11eb99e..1a0f47b 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102440868.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102440868.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102518346.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102518346.png" index 1d1ac9d..457a35a 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102518346.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102518346.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102558031.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102558031.png" index 5a3d1a0..7b7e533 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102558031.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102558031.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102705291.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102705291.png" index b6cdab5..9585236 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102705291.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102705291.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102729742.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102729742.png" index b717893..813a818 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102729742.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513102729742.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103034036.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103034036.png" index 932282c..1c54521 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103034036.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103034036.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103100965.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103100965.png" index 921d42f..6b871e5 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103100965.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103100965.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103303012.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103303012.png" index b3c6b89..5c746ac 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103303012.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103303012.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103852668.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103852668.png" index be566a7..167610b 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103852668.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103852668.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103918387.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103918387.png" index 7524b7b..cca9d2f 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103918387.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513103918387.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513104016387.png" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513104016387.png" index 597859c..990ad71 100644 Binary files "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513104016387.png" and "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/image-20220513104016387.png" differ diff --git "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/index.html" "b/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/index.html" deleted file mode 100644 index f03e4fa..0000000 --- "a/2022/05/13/\345\277\253\351\200\237\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204\344\270\252\344\272\272\345\215\232\345\256\242/index.html" +++ /dev/null @@ -1,669 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 快速搭建自己的个人博客 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

快速搭建自己的个人博客

- -
-

前言

完全免费

-
    -
  1. 通过淘宝账号登陆, codeup.aliyun.com, 免费。

    -
  2. -
  3. 登陆 github.com ,注册一个账号,免费。我这里账号是slcnx

    -
  4. -
  5. 安装windows git, https://gitforwindows.org/ 下载之后,直接安装。

    -

    需要先验证git, windows 打开 CMD , 输入 git --version 看到版本号,说明git安装OK

    -

    image-20220513093045210

    -
  6. -
  7. 安装windows node, https://nodejs.org/en/download/ 下载之后,直接安装

    -

    需要先验证node, windows 打开 CMD , 输入 node --version 看到版本号,说明node安装OK

    -

    image-20220513093341959

    -
  8. -
  9. 安装vscode, https://code.visualstudio.com/ 下载之后,直接安装

    -
  10. -
  11. 安装typora, https://typora.io/releases/all 下载, 直接安装

    -
  12. -
- - - - -

准备hexo基础模板

克隆git, 在CMD执行, 以下目录

-
1
git clone --recurse-submodules https://github.com/slcnx/hexo-template.git blog
- -
-

不成功多执行几次, 当看到100% 就表示成功了

-
-

image-20220513094643815

-

现在进入克隆目录

-
1
cd blog
- -

image-20220513093934096

-

克隆子项目git submodule update --init --recursive

-

image-20220513094748529

-

现在安装依赖 npm install

-

image-20220513095055192

-

现在在命令行输入 start .

-

image-20220513093954383

-

看到以下界面

-

image-20220513094013505

-

vscode打开目录, 运行服务

回到上一级目录,blog目录, 右键 通过 Code 打开

-

image-20220513094214889

-

进入到以下界面

-

image-20220513094228729

-

现在安装插件, 并退出vscode程序,之后重新 blog目录, 右键 通过 Code 打开

-

image-20220513094320097

-

现在快捷键 ctrl + shift + ` 运行 npx hexo s

-

image-20220513095212339

-

访问本地的4000 http://localhost:4000/

-

image-20220513095237808

-

github准备

准备github仓库

查看自己的账号名 , 我的为 slcnx

-

image-20220513095332738

-

新建仓库 slcnx.github.io 格式是用户名.github.io

-

image-20220513095640820

-

image-20220513095652519

-

添加一个测试文件

image-20220513095752726

-

一定要添加index.html

-

image-20220513095822054

-

添加之后,刷新网页,过3分钟的样子,右下角出现 active

-

image-20220513095942064

-

访问网页 https://slcnx.github.io 用户名.github.io

-

image-20220513100016239

-

现在表示github.com已经正常

-

配置github

image-20220513100103791

-

image-20220513100129679

-

现在需要生成一个公钥和密钥ssh-keygen -t rsa -b 4096 -f id_rsa_2048 -P '' 命令一定要对

-
-

此处一定要在Linux主机上生成。之后下载 id_rsa_2048 id_rsa_2048.pub 到本地 博客blog目录

-
-

vscode中查看公钥,复制公钥

-

image-20220513100509093

-

image-20220513100606627

-

看到以下内容表示OK

-

image-20220513100630996

-

获取github的ssh地址

image-20220513100825116

-

git@github.com:slcnx/slcnx.github.io.git

-

有docker的同学可以, 可以运行以下命令验证是否正常。没有docker的同学,就不需要执行以下命令

-
1
docker build --build-arg GITHUB=git@github.com:slcnx/slcnx.github.io.git --build-arg EMAIL='2192383945@qq.com' --build-arg GUSER='songliangcheng' ./
- -

codeup准备

准备codeup仓库

image-20220513101358650

-

image-20220513101431944

-

获取https地址 https://codeup.aliyun.com/5f73e5a3728df4b180fab5ca/myblog-2022-05-13.git

-

image-20220513101457691

-

本地推送代码

先在blog目录中, 即进入CMD中,在blog目录中

-
1
git remote set-url origin https://codeup.aliyun.com/5f73e5a3728df4b180fab5ca/myblog-2022-05-14.git
- -

image-20220513101730325

-

推送代码, 双击push.sh

-

image-20220513101816443

-

代码仓库, 已经有数据了

-

image-20220513101839833

-

添加流水线

进入流水线页面

image-20220513101902870

-

image-20220513101910710

-

image-20220513101941108

-

配置流水线

因为代码中有submodule, 就启用

-

image-20220513102015626

-

定义构建镜像

-

image-20220513102242848

-

image-20220513102317624

-

配置构建参考,非常关键, 这里有3个参数

-
1
2
3
EMAIL       你的QQ邮箱 
GUSER 你的用户名,任意
GITHUB 这里一定是你上面github创建的仓库的ssh地址,参考4.4获取githubssh地址。我的为 git@github.com:slcnx/slcnx.github.io.git
- -

image-20220513103303012

-

不需要发布所以删除kubernetes

-

image-20220513102349111

-

保存并运行

-

image-20220513102407557

-

运行流水线

image-20220513102417620

-

查看日志

image-20220513102440868

-

image-20220513103852668

-

查看github.com

image-20220513103918387

-

查看网页

https://slcnx.github.io/

-

image-20220513102518346

-

写新的文章

添加文章

运行addarticle.sh脚本, 写标题 第3个文章

-

image-20220513102558031

-

会自动弹出博客编写页面 编写第3个文章

-

image-20220513103034036

-

image-20220513103100965

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
title: 第3个文章
tags:
- linux
categories:
- hexo
date: 2022-05-13 10:26:14
---

# 背景

hello

![image-20220513102937310](第3个文章/image-20220513102937310.png)

<!--more-->
- - - -

发布文章

运行push.sh脚本

-

image-20220513102729742

-

查看网页

image-20220513104016387

-

自定义网页样式

本地开发

- -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
- -
- - -
-
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/2022/05/14/Linux\345\216\206\345\217\262/index.html" "b/2022/05/14/Linux\345\216\206\345\217\262/index.html" deleted file mode 100644 index 3cde3bd..0000000 --- "a/2022/05/14/Linux\345\216\206\345\217\262/index.html" +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Linux历史 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

Linux历史

- -
-

背景

linux发展历

- - - -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
- - -
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/image-20220514205710517.png" "b/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/image-20220514205710517.png" index 080b093..42c8a9f 100644 Binary files "a/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/image-20220514205710517.png" and "b/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/image-20220514205710517.png" differ diff --git "a/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/index.html" "b/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/index.html" deleted file mode 100644 index 34d5bc5..0000000 --- "a/2022/05/14/\344\270\252\344\272\272\350\256\241\345\210\222/index.html" +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 个人计划 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

个人计划

- -
-

背景

刚学linux, 做一些计划。

- - - - -

时间安排

image-20220514205710517

- -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
- - -
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/20220611105932.png" "b/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/20220611105932.png" index 641a394..d8b9250 100644 Binary files "a/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/20220611105932.png" and "b/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/20220611105932.png" differ diff --git "a/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/index.html" "b/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/index.html" deleted file mode 100644 index b43702f..0000000 --- "a/2022/06/12/vmware\345\256\211\350\243\205\347\263\273\347\273\237/index.html" +++ /dev/null @@ -1,530 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Vmware安装系统 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

Vmware安装系统

- -
-

主机初始化前规划

image-20220611105931193

-

安装规划

-

haproxy 高可用, 配置动静分离: [https://blog.51cto.com/blief/1751806]

-
    -
  • 更新, 回滚:下线,更新,上线。
  • -
  • 加节点, 配置haproxy代理,配置tomcat, 重新发应用。
  • -
-

Kubernetes时代

-
    -
  • 更新: kubectl set image -n ns deploy/myapp container_name=镜像名,
  • -
  • 回滚: kubectl rollout undo -n ns deploy/myapp
  • -
-

系统安装

    -
  1. 下载

    -

    centos: [https://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/]

    - -

    ubuntu: [https://mirrors.aliyun.com/ubuntu-releases/focal/ubuntu-20.04.4-live-server-amd64.iso]

    - -
    1
    2
    # 修改网卡名
    net.ifnames=0 biosdevname=0
  2. -
  3. 安装,完成,快照。os

    -
  4. -
  5. 初始化,验证,快照。 init

    -
  6. -
  7. 完整克隆,改主机名,IP,重启验证,快照。

    -
  8. -
-

初始化脚本

http://blog.mykernel.cn 我的博客

-

使用bash script.sh -h

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
#!/bin/bash
#
#********************************************************************
#Author: Songliangcheng
#QQ: 2192383945
#Date: 2020-11-10
#FileName: linux_template_install.sh
#URL: http://www.magedu.com
#Description: 借鉴N49同学N49030 广州 程昱余脚本所写
#Copyright (C): 2020 All rights reserved
#********************************************************************
# openssh-server配置
PORT=22
ALLOW_ROOT_LOGIN=yes
ALLOW_PASS_LOGIN=yes
# root密码配置
ROOT_PASS="123456"
# 主机名配置
HOSTNAME=chengdu-huayang-linux39-template-0-167.magedu.local
# 网络配置
IPADDR=192.168.0.123
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=223.6.6.6
AUTHOR=magedu
QQ=1062670898,2967305595
DESCRIBE="A test Script from www.magedu.com"
CURRENT_DIR=$(dirname $(readlink -f $0))

# 配置vimrc环境
set_vimrc() {
echo "开始配置vimrc环境"
cat>~/.vimrc<<EOF
set nu
set cul
set tabstop=2
set expandtab
set shiftwidth=2
set ai
set softtabstop=2
map <F2> :set paste <CR> o
map <F3> :set expandtab <CR> :%retab! <CR> :wq! <CR>
map <F4> :set binary <CR> :set noendofline <CR> :wq! <CR>
autocmd BufNewFile *.sh exec ":call SetTitle()"
function SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
call setline(2,"#")
call setline(3,"#********************************************************************")
call setline(4,"#Author: $1")
call setline(5,"#QQ: $2")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#FileName: ".expand("%"))
call setline(8,"#URL: http://blog.mykernel.cn")
call setline(9,"#Description: $3")
call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(11,"#********************************************************************")
call setline(12,"")
endif
endfunc
autocmd BufNewFile * normal G
EOF

echo "配置成功"
}





# 配置中文
set_chinese() {
echo "开始配置中文"
yum -y install kde-l10n-Chinese glibc-common
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
echo '
export LANG=zh_CN.utf8
' > /etc/profile.d/chinese.sh
echo "配置成功"
}
set_chinese_ubuntu() {
echo "开始配置中文"
apt update
if [ $? -ne 0 ]; then
pkill apt-get
pkill apt-get
apt update
fi
apt-get install language-pack-zh* -y
echo 'LANG="zh_CN.UTF-8"' > /etc/default/locale
dpkg-reconfigure --frontend=noninteractive locales
update-locale LANG=zh_CN.UTF-8
echo "配置成功"
}


# 配置openssh-server
set_openssh_server() {
echo "开始配置openssh-server"
cat > /etc/ssh/sshd_config <<EOF
Port ${1:-22}
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
PermitRootLogin ${2:-prohibit-password}
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication ${3:-yes}
#PubkeyAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
UseDNS no
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/libexec/openssh/sftp-server
EOF
echo "配置成功"
}
set_openssh_server_ubuntu() {
echo "开始配置openssh-server"
cat > /etc/ssh/sshd_config <<EOF
Port ${1:-22}
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
PermitRootLogin ${2:-prohibit-password}
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication ${3:-yes}
#PubkeyAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
UseDNS no
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/lib/openssh/sftp-server
EOF
echo "配置成功"
}

# 配置root密码
set_root_passwd() {
echo "开始配置root密码"
echo "$1" | passwd --stdin root
echo "配置成功"
}
set_root_passwd_ubuntu() {
echo "开始配置root密码"
echo "root:$1" | chpasswd
echo "配置成功"
}


# 配置主机名
set_hostname() {
echo "开始配置主机名"
echo "$1" > /etc/hostname
hostnamectl set-hostname "$1"
echo "配置成功"
}

# 配置网卡名
set_ethX() {
echo "开始配置网卡名"
sed -Ei.bak '/GRUB_CMDLINE_LINUX=/s/quiet.*$/quiet net.ifnames=0 biosdevname=0"/' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg > /dev/null
echo "配置成功"
}
set_ethX_ubuntu() {
echo "开始配置网卡名"
sed -Ei.bak '/GRUB_CMDLINE_LINUX=/s/quiet.*$/quiet net.ifnames=0 biosdevname=0"/' /etc/default/grub
update-grub
echo "配置成功"
}


# 获取掩码长度
mask2cdr ()
{
# Assumes there's no "255." after a non-255 byte in the mask
local x=${1##*255.}
set -- 0^^^128^192^224^240^248^252^254^ $(( (${#1} - ${#x})*2 )) ${x%%.*}
x=${1%%$3*}
echo $(( $2 + (${#x}/4) ))
}


# 配置IP
set_ip() {
echo "开始配置IP"
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
TYPE=Ethernet
BOOTPROTO=static
DEVICE=eth0
ONBOOT=yes
IPADDR=$1
NETMASK=$2
GATEWAY=$3
#DNS1=192.168.0.1
EOF


cat > /etc/resolv.conf <<EOF
nameserver $4
EOF

echo "配置成功"
}
set_ip_ubuntu() {
echo "开始配置IP"

cat > /etc/netplan/01-netcfg.yaml <<EOF
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
addresses: [$1/$(mask2cdr $2)]
gateway4: $3
nameservers:
addresses: [$4]
EOF
netplan apply
echo "配置成功"
}



# 安装常用命令
set_install_basepkgs() {
echo "开始安装常用命令"
yum remove -y NetworkManager* firewalld*
# 卸载NetworkManger之后dns会出问题
echo 'nameserver 114.114.114.114' > /etc/resolv.conf
yum install -y vim wget tree lrzsz gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop ntpdate lsof
echo "配置成功"

echo "关闭selinux"
sed -Ei.bak '/SELINUX=/s/(SELINUX=)enforcing/\1disabled/' /etc/selinux/config
echo "配置成功"
}


set_install_basepkgs_ubuntu() {
apt purge ufw lxd lxd-client lxcfs lxc-common -y
apt install iproute2 ntpdate tcpdump telnet traceroute nfs-kernel-server nfs-common lrzsz tree openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev ntpdate tcpdump telnet traceroute gcc make openssh-server lrzsz tree openssl libssl-dev libpcre3 libpcre3-dev zlib1g-dev ntpdate tcpdump telnet traceroute iotop unzip zip lsof make curl iputils-ping net-tools -y
}
# 优化系统资源限制
set_limit() {
echo "开始优化系统资源限制"
cat > /etc/security/limits.conf <<'EOF'
root soft core unlimited
root hard core unlimited
root soft nproc 1000000
root hard nproc 1000000
root soft nofile 1000000
root hard nofile 1000000
root soft memlock 32000
root hard memlock 32000
root soft msgqueue 8192000
root hard msgqueue 8192000
* soft core unlimited
* hard core unlimited
* soft nproc 1000000
* hard nproc 1000000
* soft nofile 1000000
* hard nofile 1000000
* soft memlock 32000
* hard memlock 32000
* soft msgqueue 8192000
* hard msgqueue 8192000
EOF
echo "配置成功"
}


# 开始优化内核参数
set_kernel_params() {
cat > /etc/sysctl.conf <<'EOF'
# 1:开启严格的反向路径校验。对每个进来的数据包,校验其反向路径是否是最佳路径。如果反向路径不是最佳路径,则直接丢弃该数据包。
# 减少DDoS攻击,校验数据包的反向路径,如果反向路径不合适,则直接丢弃数据包,避免过多的无效连接消耗系统资源。
# 防止IP Spoofing,校验数据包的反向路径,如果客户端伪造的源IP地址对应的反向路径不在路由表中,或者反向路径不是最佳路径,则直接丢弃数据包,不会向伪造IP的客户端回复响应。
net.ipv4.conf.default.rp_filter = 1
# 监听非本机
net.ipv4.ip_nonlocal_bind = 1
# 转发
net.ipv4.ip_forward = 1
#处理无源路由的包
net.ipv4.conf.default.accept_source_route = 0
#关闭sysrq功能
kernel.sysrq = 0
#core文件名中添加pid作为扩展名
kernel.core_uses_pid = 1
# tcp_syncookies是一个开关,是否打开SYN Cookie功能,该功能可以防止部分SYN攻击。tcp_synack_retries和tcp_syn_retries定义SYN的重试次数。
net.ipv4.tcp_syncookies = 1
# docker
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
# docker运行时,需要设置为1
fs.may_detach_mounts = 1
#修改消息队列长度
kernel.msgmnb = 65536
kernel.msgmax = 65536
#设置最大内存共享段大小bytes
kernel.shmmax = 68719476736
kernel.shmall = 4294967296

net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
# net.core.somaxconn 是Linux中的一个kernel参数,表示socket监听(listen)的backlog上限。什么是backlog呢?backlog就是socket的监听队列,当一个请求(request)尚未被处理或建立时,他会进入backlog。而socket server可以一次性处理backlog中的所有请求,处理后的请求不再位于监听队列中。当server处理请求较慢,以至于监听队列被填满后,新来的请求会被拒绝。
net.core.somaxconn = 20480
net.core.optmem_max = 81920
# tcp_max_syn_backlog 进入SYN包的最大请求队列.默认1024.对重负载服务器,增加该值显然有好处.
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 15
# 在使用 iptables 做 nat 时,发现内网机器 ping 某个域名 ping 的通,而使用 curl 测试不通, 原来是 net.ipv4.tcp_timestamps 设置了为 1 ,即启用时间戳
net.ipv4.tcp_timestamps = 0
# tw_reuse 只对客户端起作用,开启后客户端在1s内回收
net.ipv4.tcp_tw_reuse = 1
# recycle 同时对服务端和客户端启作用。如果服务端断开一个NAT用户可能会影响。
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 1
# Nginx 之类的中间代理一定要关注这个值,因为它对你的系统起到一个保护的作用,一旦端口全部被占用,服务就异常了。 tcp_max_tw_buckets 能帮你降低这种情况的发生概率,争取补救时间。
net.ipv4.tcp_max_tw_buckets = 20000
# 这个值表示系统所能处理不属于任何进程的socket数量,当我们需要快速建立大量连接时,就需要关注下这个值了。
net.ipv4.tcp_max_orphans = 327680
# 15. 现大量fin-wait-1
#首先,fin发送之后,有可能会丢弃,那么发送多少次这样的fin包呢?fin包的重传,也会采用退避方式,在2.6.358内核中采用的是指数退避,2s,4s,最后的重试次数是由
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syncookies = 1
# KeepAlive的空闲时长,或者说每次正常发送心跳的周期,默认值为7200s(2小时)
net.ipv4.tcp_keepalive_time = 300
# KeepAlive探测包的发送间隔,默认值为75s
net.ipv4.tcp_keepalive_intvl = 30
# 在tcp_keepalive_time之后,没有接收到对方确认,继续发送保活探测包次数,默认值为9(次)
net.ipv4.tcp_keepalive_probes = 3
# 允许超载使用内存,避免内存快到极限报错
vm.overcommit_memory = 1
# 0,内存不足启动oom killer. 1内存不足,kernel panic(系统重启) 或oom. 2. 内存不足, 强制kernel panic. (系统重启)
vm.panic_on_oom=0
vm.swappiness = 10
#net.ipv4.conf.eth1.rp_filter = 0
#net.ipv4.conf.lo.arp_ignore = 1
#net.ipv4.conf.lo.arp_announce = 2
#net.ipv4.conf.all.arp_ignore = 1
#net.ipv4.conf.all.arp_announce = 2
net.ipv4.tcp_mem = 786432 1048576 1572864
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
# 随机端口的范围
net.ipv4.ip_local_port_range = 10001 65000

# inotify监听文件数量
fs.inotify.max_user_watches=89100

# 文件打开数量
# 所有进程
fs.file-max=52706963
# 单个进程
fs.nr_open=52706963
EOF
echo "配置成功"
}


# 镜像
set_mirrors_aliyun_ubuntu() {
sed -i.bak -e 's@us.archive.ubuntu.com@mirrors.aliyun.com@g' -e 's@security.ubuntu.com@mirrors.aliyun.com@g' /etc/apt/sources.list
apt update
}

# 配置时间同步
set_time_sync() {
echo "开始配置时间同步"
echo '*/5 * * * * /usr/sbin/ntpdate time1.aliyun.com &> /dev/null' > /var/spool/cron/root
echo "配置成功"
}
# 配置时间同步
set_time_sync_ubuntu() {
echo "开始配置时间同步"
echo '*/5 * * * * /usr/sbin/ntpdate time1.aliyun.com &> /dev/null' > /var/spool/cron/crontabs/root
echo "配置成功"
}

function usage {
cat << END
$(basename $0) OPTION ...
--port=<port> ssh服务监听的端口, 默认22
--allow-root-login=<prohibit-password|yes> ssh配置是否让root能登陆,默认prohibit-password.
--allow-pass-login=<yes|no> ssh配置是否让pass能登陆,默认yes
--root-password=<root_pass> 配置root登陆密码,默认123456
--hostname=<hostname> 配置主机名,cd-hy-linux39-centos-0-167.magedu.local
--ipaddr=<ipaddr> 配置IP, 默认192.168.0.123
--netmask=<netmask> 配置掩码, 默认255.255.255.0
--gateway=<gateway> 配置网关,默认192.168.0.1
--dns=<dns> 配置DNS, 默认223.6.6.6
--author=<author> 配置vimrc生成脚本的作者, 默认magedu
--qq=<author> 配置vimrc生成脚本的qq, 我的班主任萌萌老师: 2967305595
--desc=<desc> 配置vimrc生成脚本的描述, 默认: A test Script from magedu
--chinese= 配置中文, openstack python2, 不要启用
--eth0= 配置eth0接口
--resourceslimit= 配置资源限制
--kernelparams= 配置内核优化
--basepkgs= 配置基础包
--umirror= 配置镜像加速, only ubuntu


# 所有功能 非中文
# bash $(basename $0) \
--port=22 --allow-root-login=yes --allow-pass-login=yes \
--root-password=123456 \
--hostname=ubuntu-template.magedu.local \
--ipaddr=192.168.0.123 --netmask=255.255.255.0 --gateway=192.168.0.1 \
--dns=223.6.6.6 \
--author=songliangcheng --qq=2192383945 --desc="A test toy" \
--resourceslimit=1 \
--kernelparams=1 \
--basepkgs=1 \
--chinese=0 \
--eth0=0 \
--umirror=1


示例:只配置主机名和vimrc和参数优化 中文
# bash $(basename $0) \
--hostname=ubuntu-template.magedu.local \
--author=songliangcheng --qq=2192383945 --desc="A test toy" \
--resourceslimit=1 \
--kernelparams=1 \
--basepkgs=1 \
--chinese=1 \
--eth0=0 \
--umirror=1

示例: 无操作
bash -x linux_template_install.sh --resourceslimit=0 --kernelparams=0 --basepkgs=0 --chinese=0 --eth0=0 --umirror=0

END

}


ssh=0
pass=0
hname=0
vimrc=0
net=0
chinese=0
eth0=0
resourceslimit=0
kernelparams=0
basepkgs=0
umirror=0
for option
do
case "$option" in
-*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
*) value="" ;;
esac

case "$option" in
--help)
usage
exit 1
;;
--port=*)
PORT="$value"
ssh=1
;;
--allow-root-login=*)
ALLOW_ROOT_LOGIN="$value"
ssh=1
;;
--allow-pass-login=*)
ALLOW_PASS_LOGIN="$value"
ssh=1
;;
--root-password=*)
ROOT_PASS="$value"
pass=1
;;
--hostname=*)
HOSTNAME="$value"
hname=1
;;
--ipaddr=*)
IPADDR="$value"
net=1
;;
--netmask=*)
NETMASK="$value"
net=1
;;
--gateway=*)
GATEWAY="$value"
net=1
;;
--dns=*)
DNS1="$value"
net=1
;;
--author=*)
AUTHOR="$value"
vimrc=1
;;
--qq=*)
QQ="$value"
vimrc=1
;;
--desc=*)
DESCRIBE="$value"
vimrc=1
;;
--chinese=*)
chinese="$value"
;;
--eth0=*)
eth0="$value"
;;
--resourceslimit=*)
resourceslimit="$value"
;;
--kernelparams=*)
kernelparams="$value"
;;
--basepkgs=*)
basepkgs="$value"
;;
--umirror=*)
umirror="$value"
;;
*)
echo "$0: error: invalid option \"$option\""
usage
exit 1
;;
esac
done


[ -z "$option" ] && echo "$0: error: invalid option \"$option\"" && exit 1




centos_init() {
if [ $vimrc -eq 1 ]; then
# 配置vim环境
set_vimrc "$AUTHOR" "$QQ" "$DESCRIBE"
fi

if [ $chinese -eq 1 ]; then
# 配置中文
set_chinese
fi

if [ $ssh -eq 1 ]; then
# 配置ssh
# ubuntu: Subsystem sftp /usr/lib/openssh/sftp-server
# set_openssh_server 端口 是否允许root登陆 是否允许密码登陆
set_openssh_server $PORT $ALLOW_ROOT_LOGIN $ALLOW_PASS_LOGIN
fi

if [ $pass -eq 1 ]; then
# 配置root密码
set_root_passwd "$ROOT_PASS"
fi

if [ $hname -eq 1 ]; then
# 配置主机名
# 地区-机房-业务-服务-ip后缀.域名.后缀
# chengdu-huayang-linux39-centos-0-167.magedu.local
set_hostname "$HOSTNAME"
fi

if [ $eth0 -eq 1 ]; then
set_ethX
fi

if [ $net -eq 1 ]; then
# set_ip IP MASK GATEWAY
set_ip "$IPADDR" "$NETMASK" "$GATEWAY" "$DNS1"
fi

if [ $basepkgs -eq 1 ]; then
# 安装基础包
set_install_basepkgs
fi
if [ $resourceslimit -eq 1 ]; then
# 配置限制和内核参数
set_limit
fi
if [ $kernelparams -eq 1 ]; then
set_kernel_params
fi
# 配置时间同步
set_time_sync
# 提示
# Set Logon failure handling
#限制登入失败三次,普通账号锁定5分钟,root账号锁定5分钟
if ! grep -q root_unlock_time=300 /etc/pam.d/sshd; then
sed -i '/^#%PAM-1.0/a\auth required pam_tally2.so deny=3 unlock_time=300 even_deny_root root_unlock_time=300' /etc/pam.d/sshd
fi
}
ubuntu_init() {

if [ $umirror -eq 1 ]; then
# 配置镜像源
set_mirrors_aliyun_ubuntu
fi

if [ $chinese -eq 1 ]; then
# 配置中文
set_chinese_ubuntu
fi

if [ $vimrc -eq 1 ]; then
set_vimrc "$AUTHOR" "$QQ" "$DESCRIBE"
fi

if [ $ssh -eq 1 ]; then
set_openssh_server_ubuntu $PORT $ALLOW_ROOT_LOGIN $ALLOW_PASS_LOGIN
fi

if [ $pass -eq 1 ]; then
set_root_passwd_ubuntu "$ROOT_PASS"
fi

if [ $hname -eq 1 ]; then
set_hostname "$HOSTNAME"
fi

if [ $eth0 -eq 1 ]; then
set_ethX_ubuntu
fi
if [ $net -eq 1 ]; then
set_ip_ubuntu "$IPADDR" "$NETMASK" "$GATEWAY" "$DNS1"
fi
if [ $basepkgs -eq 1 ]; then
set_install_basepkgs_ubuntu
fi
if [ $resourceslimit -eq 1 ]; then
# 配置限制和内核参数
set_limit
fi

if [ $kernelparams -eq 1 ]; then
set_kernel_params
fi
# 配置时间同步
set_time_sync_ubuntu
}

# Set Shell History and TMOUT
# HISTSIZE has been set to 10000
sed -i 's/^HISTSIZE=.*$/HISTSIZE=10000/g' /etc/profile
# HISTTIMEFORMAT has been set to "Number-Time-User-Command"
echo 'export HISTTIMEFORMAT="%F %T `whoami` "' > /etc/profile.d/secuirty.sh
# 终端超时10分钟
echo TMOUT=600 >> /etc/profile.d/secuirty.sh

if which apt &> /dev/null; then
ubuntu_init
else
centos_init
fi
cat << EOF
# reboot
请reboot, 验证ip, 域名解析, kernel params, crontab, ssh, alias
EOF

cd $CURRENT_DIR
rm -f $0
- - -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
- - -
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708133820.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708133820.png" index e31b3fa..62ad9c2 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708133820.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708133820.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708163408.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708163408.png" index 859a57d..6519d87 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708163408.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708163408.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708165430.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708165430.png" index 2d00e01..efb212d 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708165430.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708165430.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708171022.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708171022.png" index d3c5f04..33d1a08 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708171022.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708171022.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708172130.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708172130.png" index b7f59df..21df309 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708172130.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708172130.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708210651.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708210651.png" index f7f68e9..ba35ab4 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708210651.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708210651.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708214530.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708214530.png" index d63774a..ee4e468 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708214530.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220708214530.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220709173503.png" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220709173503.png" index 26746b4..8e6039c 100644 Binary files "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220709173503.png" and "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/20220709173503.png" differ diff --git "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/index.html" "b/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/index.html" deleted file mode 100644 index 11d675d..0000000 --- "a/2022/07/09/Nginx-\347\274\226\350\257\221\345\256\211\350\243\205/index.html" +++ /dev/null @@ -1,878 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Nginx-编译安装 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

Nginx-编译安装

- -
-

回顾

上一节中,我们讲了[ https://slcnx.github.io/2022/06/12/vmware%E5%AE%89%E8%A3%85%E7%B3%BB%E7%BB%9F/ ], vmware安装规划中,如何单机部署, 高可用部署。 本节讲讲其中一个小服务nginx,nginx用来提供公司网页的,基于用户体验的过程的原理如下:

-

image-20220708133818176

-

这里电脑从输入www.baidu.com到查看到百度,这一个过程中,需要本地计算机**浏览器**发起http请求,请求支持http协议的**web服务器**,拿到http响应。http协议规范定义了**请求和响应**的格式,[ https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Messages ], 而http协议是一种规范其实现是具体的软件,其客户端软件, 图形界面的浏览器(chrome, 360, firefox),命令行的curl命令。而服务端软件有httpd, nginx

-

我们在上一节中使用nginx作为静态站点,而没有使用apache的httpd,其原因就需要对比这两个软件的区别了。

-

nginx和apache的区别

请求到达服务器处理

Nginx IO模型

-
-

参考: [ https://www.modb.pro/db/401325 ]

-
-

浏览器请求到Linux服务器,基于请求的端口到达用户空间的进程,进程处理http协议的请求,基于URI解析协议, 域名,路径。从而找到对应的处理请求的配置,再加载合适的文件或代理到合适的后端应用服务器。

-
    -
  • 动态请求,基于相应的协议获取数据。
  • -
  • 静态请求,需要读磁盘上的文件,就需要发起系统调用,内核加载数据到内核空间,进程从内核空间将数据拷贝到用户空间。这个是一次文件IO
  • -
-

请求到达用户空间的web进程的几种方式

-
    -
  • 阻塞式IO

    -
      -
    • 请求数据未完全被内核加载到缓冲区时,进程是阻塞的。进程不占用CPU,并在等待队列中。直到数据加载完成,一次中断事件让内核把等待队列中的进程唤醒到达运行队列,这个时间进程才拿到数据,进行处理数据。
    • -
    • 一个进程处理一个请求
    • -
    -
  • -
  • 非阻塞IO

    -
      -
    • 进程调用函数时,只要未加载完成,就返回error。未加载完成就不是error, 处理数据。下面是模拟的代码,不是error处理数据,是error会做完其他事后再循环,浪费大量CPU进行查看数据是否完成。

      -
      1
      2
      3
      4
      5
      6
      while true; do 
      if [ `read` !== “error" ]; then
      #处理数据
      fi
      # 做其他事
      done
    • -
    -
  • -
-

由于阻塞式IO不能处理多个请求,所以有了IO多路复用,专用于处理多个请求,io多路复用,支持select/poll/epoll。

-
    -
  • select
      -
    • 很多系统均支持
    • -
    • 进程调用select之后,就和非阻塞IO一样,立即知道有没有数据。没有数据做其他的事。有数据就下一次问select时就拿到数据加载数据到内存,进行后续处理。
    • -
    • select就可以维护多个连接,使用一个数组,要知道数组中哪个连接有新的数据来,需要遍历一次数组,时间复杂度是O(n)。
    • -
    • select默认的连接上限1024
    • -
    -
  • -
  • poll
      -
    • windows不支持
    • -
    • 维护多个连接是链表,没有连接上限。知道哪个连接有数据来是遍历,时间复杂 度是O(n)
    • -
    -
  • -
  • epoll
      -
    • 进程调用epoll之后,会注册一个信号,这个信号函数会有后续的处理,所以当数据准备好之后,就调用进程的后续函数进行加载数据到用户空间的内存,再处理。
    • -
    • 维护连接是hash表,知道哪个连接有数据来是遍历,时间复杂 度是O(1)。
    • -
    -
  • -
-

以上5种IO模型,在内核准备数据时进程除了第1个均是非阻塞,非阻塞中除了epoll 信号驱动之外均是同步,即进程轮轮循查看数据是否就绪。在数据准备好之后,均由各自函数加载数据到用户空间,进行处理。

-

网络&操作系统-linux五种IO模型| 池元烨的博客

-
-

引用自: [ http://chiyuanye.com/2019/02/25/five-IO-models.html ]

-
-

aio_read这个函数是异步的,内核准备数据,数据加载到用户空间进程内存,均由内核完成,完成之后通知进程。进程进行后续操作。

-

区别

apache有2.2和2.4 这2个版本。均有3个处理模块,( prefork, work, event )。

-
    -
  • apache
      -
    • prefork, select IO模型
    • -
    • work, poll IO模型
    • -
    • event, event IO模型
    • -
    -
  • -
  • nginx
      -
    • aio_read
    • -
    -
  • -
-

nignx特点: 异步非阻塞IO解决C10K问题(10K Connections),且是免费的、开源的、⾼性能的HTTP服务器HTTP反向代理服务器邮件代理服务器、以及TCP/UDP代理服务器

-

Nginx的优势在于:反向代理,静态资源Web服务,rewrite规则,稳定性, 模块化设计,静态文件处理,内存消耗,节省带宽,稳定性高,支持热部署,可以高并发连接等优点。

-

Netcraft公司于1994年底在英国成⽴,多年来⼀直致⼒于互联⽹市场以及在线安全⽅⾯的咨询服务,其中在国际上最具影响⼒的当属其针对⽹站服务器,域名解析/主机提供商,以及SSL市场所做的客观严谨的分析研究。

-

[ https://news.netcraft.com/ ] nginx 自19起始稳居第1。而之前一直是apache占主导地位。

-

image-20220708165429539

-
-

引用自: [ https://zhangzhuo.ltd/articles/2021/05/17/1621240754222.html ]

-
-

nginx介绍

模块化设计,较好的扩展性 高可靠性 支持热部署:不停机更新配置⽂件,升级版本,更换⽇志⽂件 低内存消耗:10000个keep-alive连接模式下的⾮活动连接,仅需2.5M内存 event-driven,aio,mmapsendfile

-
-

image-20220708172129010

-

mmap要比普通的read系统调用少了一次copy的过程。因为read调用,进程是无法直接访问kernel space的,所以在read系统调用返回前,内核需要将数据从内核复制到进程指定的buffer。但mmap之后,进程可以直接访问mmap的数据(page cache)。第2个阶段 kernel > user space不需要了。

-

引用自: [ https://blog.csdn.net/universsky2015/article/details/115114706 ]

-

作为web服务器的时候打开sendfile加快静态⽂件传输,指定是否使⽤sendfile系统调⽤来传输⽂件,sendfile通过DMA(直接内存访问)⽅式直接访问⽂件数据,并通过传输协议发送,从⽽避免了数据在内核缓冲区和⽤户缓冲区之间的拷⻉,操作效率很⾼,被称之为零拷⻉,从硬盘>kernel>user space封装>kernel>协议栈,直接到: 硬盘>> kernel buffer (快速拷⻉到kernel socket buffer) >>协议栈。

-
-

环境初始化

    -
  1. 准备nginx主机

    -
  2. -
  3. 实验归划

    -

    image-20220708210648579

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IP主机名用途备注
    172.16.100.100template-centos.magedu.com模板机
    172.16.100.101nginx-1.magedu.com
    172.16.100.102nginx-2.magedu.com
    172.16.100.103nginx-3.magedu.com
    172.16.100.104nginx-4.magedu.com
    172.16.100.105nginx-5.magedu.com
    172.16.100.106nginx-6.magedu.com
    172.16.100.107nginx-7.magedu.com
    172.16.100.108nginx-8.magedu.com
    172.16.100.109nginx-9.magedu.com
    172.16.100.110nginx-10.magedu.com
    172.16.100.111php-1.magedu.com
    172.16.100.112php-2.magedu.com
    172.16.100.113php-3.magedu.com
    172.16.100.114php-4.magedu.com
    172.16.100.115php-5.magedu.com
    172.16.100.116php-6.magedu.com
    172.16.100.117php-7.magedu.com
    172.16.100.118php-8.magedu.com
    172.16.100.119php-9.magedu.com
    172.16.100.120php-10.magedu.com
    172.16.100.121mysql-1.magedu.com
    172.16.100.122mysql-2.magedu.com
    172.16.100.123mysql-3.magedu.com
    172.16.100.124mysql-4.magedu.com
    172.16.100.125mysql-5.magedu.com
    172.16.100.126mysql-6.magedu.com
    172.16.100.127mysql-7.magedu.com
    172.16.100.128mysql-8.magedu.com
    172.16.100.129mysql-9.magedu.com
    172.16.100.130mysql-10.magedu.com
    -
  4. -
  5. 准备网络, vmnet9, 172.16.0.0/16 网络。

    -
  6. -
  7. 克隆 最初,调整配置,快照初始,准备模板主机

    -
  8. -
  9. 初始化主机为模板主机。

    -
    1
    bash init.sh --resourceslimit=1 --kernelparams=1 --basepkgs=1 --chinese=0  --eth0=1 --umirror=0    --port=6655 --allow-root-login=yes --allow-pass-login=yes --root-password='#^DzGp)DIN+1M)'  --hostname=template-centos.magedu.com --ipaddr=172.16.100.100 --netmask=255.255.0.0 --gateway=172.16.100.2 --dns=223.6.6.6 --author=songliangcheng --qq=2192383945 --desc="A test toy"
    - -
    1
    2
    rm -f /etc/sysconfig/network-scripts/ifcfg-ens33
    reboot
  10. -
  11. 修改网络

    -
  12. -
  13. 准备网关

    -
    1
    2
    3
    4
    5
    6
    7
    #准备网关,172.16.0.2
    TYPE=Ethernet
    BOOTPROTO=static
    DEVICE=eth1
    ONBOOT=yes
    IPADDR=172.16.0.2
    NETMASK=255.255.0.0
    - -
    1
    2
    sysctl -w net.ipv4.ip_forward=1
    iptables -t nat -I POSTROUTING -s 172.16.0.0/16 -o eth0 -j MASQUERADE
    - -

    现在ping www.baidu.com

    -
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # 本机看到
    [root@template-centos ~]# tcpdump -nn -vv -i eth0 icmp
    tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
    20:22:32.070572 IP (tos 0x0, ttl 64, id 18283, offset 0, flags [DF], proto ICMP (1), length 84)
    172.16.100.100 > 110.242.68.4: ICMP echo request, id 1485, seq 28, length 64
    20:22:32.113527 IP (tos 0x0, ttl 127, id 30763, offset 0, flags [none], proto ICMP (1), length 84)
    110.242.68.4 > 172.16.100.100: ICMP echo reply, id 1485, seq 28, length 64

    # 网关看到
    192.168.131.100 > 110.242.68.4: ICMP echo request, id 1485, seq 62, length 64
    20:23:06.167984 IP (tos 0x0, ttl 128, id 30800, offset 0, flags [none], proto ICMP (1), length 84)
    110.242.68.4 > 192.168.131.100: ICMP echo reply, id 1485, seq 62, length 64
    - -

    172.16.100.100 -> 192.168.131.100 -> 110.242.68.4 (修改源为网关的可以出去的IP)

    -

    172.16.100.100 <- 192.168.131.100 <- 110.242.68.4 ( 修改目标为内网IP)

    -
  14. -
  15. 重启验证ip, 域名解析, kernel params, crontab, ssh, alias

    -
  16. -
  17. 关机快照。template,

    -
    1
    2
    3
    6655
    root
    #^DzGp)DIN+1M)
  18. -
-

准备第1个节点

-
1
2
3
bash init.sh --hostname=nginx-1.magedu.com --ipaddr=172.16.100.101 --netmask=255.255.0.0 --gateway=172.16.100.2 --dns=223.6.6.6 --root-password='7HmqYhjwvNBuYW2X'
reboot
验证ip,网络, 主机名
- - - -

编译安装nginx

https://nginx.org/en/download.html

-

Stable version nginx-1.22.0

-

制作rpm

进入nginx的源码仓库: [ http://nginx.org/packages/centos/7Server/SRPMS/ ]

-

下载安装geoip

-
1
2
3
wget http://nginx.org/packages/centos/7Server/SRPMS/nginx-module-geoip-1.22.0-1.el7.ngx.src.rpm

rpm -ivh nginx-module-geoip-1.22.0-1.el7.ngx.src.rpm
- -

准备yum-utils

-
1
yum install yum-utils rpm-build -y
- -

构建rpm包

-
1
2
3
4
5
6
cd /root/rpmbuild/SPECS
# 安装依赖的模板
# yum-builddep nginx-module-geoip.spec --downloadonly --downloaddir=/root/pkgs
# ls /root/pkgs/ | xargs -I {} echo {} | sed 's@-[0-9].*@@' | xargs
cpp e2fsprogs e2fsprogs-libs gcc GeoIP GeoIP-devel geoipupdate glibc glibc-common glibc-devel glibc-headers kernel-headers keyutils-libs-devel krb5-devel krb5-libs libcom_err libcom_err-devel libgcc libgomp libkadm5 libmpc libselinux libselinux-devel libselinux-python libselinux-utils libsepol-devel libss libverto-devel mpfr openssl openssl-devel openssl-libs pcre2 pcre2-devel pcre2-utf16 pcre2-utf32 pcre-devel zlib zlib-devel

- -

rpmbuild -bb nginx-module-geoip.spec

-
# rpm
-   [root@localhost SPECS]# ls ../RPMS/x86_64/
-    nginx-module-geoip-1.22.0-1.el7.ngx.x86_64.rpm  nginx-module-geoip-debuginfo-1.22.0-1.el7.ngx.x86_64.rpm
-rpmbuild -bb nginx
-
-

得到依赖

-
1
cpp e2fsprogs e2fsprogs-libs gcc GeoIP GeoIP-devel geoipupdate glibc glibc-common glibc-devel glibc-headers kernel-headers keyutils-libs-devel krb5-devel krb5-libs libcom_err libcom_err-devel libgcc libgomp libkadm5 libmpc libselinux libselinux-devel libselinux-python libselinux-utils libsepol-devel libss libverto-devel mpfr openssl openssl-devel openssl-libs pcre2 pcre2-devel pcre2-utf16 pcre2-utf32 pcre-devel zlib zlib-devel
- -

安装rpm之后得到编译参数

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@localhost SPECS]# rpm -ivh ../RPMS/x86_64/nginx-1.22.0-1.el7.ngx.x86_64.rpm 
准备中... ################################# [100%]
正在升级/安装...
1:nginx-1:1.22.0-1.el7.ngx ################################# [100%]
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* https://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* https://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* https://nginx.com/products/
- -
1
2
3
4
5
6
[root@localhost SPECS]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
- -

抽取部分

-
1
./configure --prefix=/apps/nginx    --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module  --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module  --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_geoip_module=dynamic --with-stream_geoip_module=dynamic
- - - -

编译安装 (ubuntu/centos均可)

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@nginx-2 ~]# tar xvf nginx-1.22.0.tar.gz -C /usr/local/src/

yum install cpp e2fsprogs e2fsprogs-libs gcc GeoIP GeoIP-devel geoipupdate glibc glibc-common glibc-devel glibc-headers kernel-headers keyutils-libs-devel krb5-devel krb5-libs libcom_err libcom_err-devel libgcc libgomp libkadm5 libmpc libselinux libselinux-devel libselinux-python libselinux-utils libsepol-devel libss libverto-devel mpfr openssl openssl-devel openssl-libs pcre2 pcre2-devel pcre2-utf16 pcre2-utf32 pcre-devel zlib zlib-devel -y

./configure --prefix=/apps/nginx \
--user=nginx --group=nginx \
--with-compat --with-file-aio --with-threads \
--with-http_addition_module --with-http_auth_request_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module \
--with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module \
--with-http_stub_status_module --with-http_sub_module --with-http_v2_module \
--with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module \
--with-http_geoip_module=dynamic --with-stream_geoip_module=dynamic

- -

你将看到以下输出

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Configuration summary
+ using threads
+ using system PCRE2 library
+ using system OpenSSL library
+ using system zlib library

nginx path prefix: "/apps/nginx"
nginx binary file: "/apps/nginx/sbin/nginx"
nginx modules path: "/apps/nginx/modules"
nginx configuration prefix: "/apps/nginx/conf"
nginx configuration file: "/apps/nginx/conf/nginx.conf"
nginx pid file: "/apps/nginx/logs/nginx.pid"
nginx error log file: "/apps/nginx/logs/error.log"
nginx http access log file: "/apps/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
- -

之后,编译安装

-
1
make -j $(nproc) && make install -j $(nproc)
- -
1
2
3
4
5
[root@nginx-2 nginx-1.22.0]# cd /apps/nginx/
[root@nginx-2 nginx]# groupadd -g 2022 nginx
[root@nginx-2 nginx]# useradd -u 2022 -s /sbin/nologin nginx -g nginx

[root@nginx-2 nginx]# ./sbin/nginx -g 'daemon off;' # 需要在前台
- -

浏览器访问 http://172.16.100.102/

-

image-20220708214528854

-

ctrl c 终止后,准备服务脚本

-
1
2
3
4
5
6
7
8
# 为当前nginx添加版本方便升级nginx, 回退
mv /apps/nginx/ /apps/nginx-1.22.0

# 自动生成服务脚本 github
curl -L https://raw.githubusercontent.com/slcnx/post-precompile/main/post-precompile.sh | bash -s -- -ap /apps/nginx-1.22.0 -s "./sbin/nginx -g 'daemon off;'"

# 自动生成服务脚本 gitee
curl -L https://gitee.com/slcnx/post-precompile/raw/master/post-precompile.sh | sed 's/\r//' | bash -s -- -ap /apps/nginx-1.22.0 -s "./sbin/nginx -g 'daemon off;'"
- -

添加模块

echo模块

编译方法: [ https://github.com/openresty/echo-nginx-module#installation ]

-

下载包: [ https://github.com/openresty/echo-nginx-module/releases/tag/v0.62 ]

-

基于以上的编译二次编译

-
1
2
3
4
5
6
7
8
9
./configure  --prefix=/apps/nginx --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_geoip_module=dynamic --with-stream_geoip_module=dynamic --add-module=/usr/local/src/echo-nginx-module-0.62/


make -j $(nproc) && make install -j $(nproc)


nginx -V

systemctl restart nginx
- -

ssl模块

引用自: [ https://www.cnblogs.com/Oejfr/p/14902721.html ]

-
1
wget https://www.openssl.org/source/openssl-3.0.5.tar.gz
- -
1
2
3
4
5
6
7
./configure  --prefix=/apps/nginx --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_geoip_module=dynamic --with-stream_geoip_module=dynamic  --with-openssl=/root/openssl-3.0.5

make -j $(nproc) && make install -j $(nproc)

nginx -V

systemctl restart nginx
- - - -

作业

    -
  1. 独立完成nginx yum安装,apt安装。
  2. -
  3. 独立完成nginx制作rpm,添加echo模块,升级ssl,同时制作rpm。
  4. -
  5. 独立完成nginx编译安装,添加echo模块,升级ssl。
  6. -
- -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
- - -
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/20220731091814.png" "b/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/20220731091814.png" index 26746b4..8e6039c 100644 Binary files "a/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/20220731091814.png" and "b/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/20220731091814.png" differ diff --git "a/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/index.html" "b/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/index.html" deleted file mode 100644 index fe09936..0000000 --- "a/2022/07/31/Nginx\351\200\232\347\224\250\351\205\215\347\275\256/index.html" +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Nginx通用配置 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

Nginx通用配置

- -
-

获取nginx配置

配置格式

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# global

# 4
stream {
...
}
# 7
http {
...
server {
...
location / {
root
index
}
}

server {
...
location / {
root
index
}
}
}

types {
...
}


- - - -
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
[root@nginx-2 ~]# nginx -T
# 语法检查
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful

# 配置文件/apps/nginx/conf/nginx.conf
# configuration file /apps/nginx/conf/nginx.conf:


####################### 全局段 #######################
#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

####################### 事件配置段 #######################
events {
worker_connections 1024;
}

####################### http配置段 #######################
http {
####################### http中的配置 #######################
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;
####################### server配置段 #######################
server {
####################### 虚拟主机配置 #######################
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

####################### location配置段 #######################
location / {
####################### url配置 #######################
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

# configuration file /apps/nginx/conf/mime.types:

types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;

text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;

image/avif avif;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;

font/woff woff;
font/woff2 woff2;

application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/wasm wasm;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;

application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;

audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;

video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
- -

版本

-
1
2
3
4
5
6
7
[root@nginx-2 ~]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/apps/nginx --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_geoip_module=dynamic --with-stream_geoip_module=dynamic
[root@nginx-2 ~]#
- -

由nginx -T可以得到几个配置段

-
    -
  • 全局 nginx配置相关
  • -
  • event IO模型配置段
  • -
  • http web服务器, http代理
      -
    • server
        -
      • location
      • -
      -
    • -
    -
  • -
  • stream tcp代理
  • -
-

全局配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
user  nginx;
worker_processes auto;
worker_cpu_affinity auto;
error_log logs/error.log error;
pid logs/nginx.pid;
#这个数字包括Nginx的所有连接(例如与代理服务器的连接等),⽽不仅仅是与客户端的连接,另⼀个考虑因素是实际的并发连接数不能超过系统级别的最⼤打开⽂件数的限制.
worker_rlimit_nofile 65536;
#/proc/sys/fs/file-max 所有进程最大的文件数

events {
#设置单个work进程的最大并发连接数 总并发 = worker_connections * worker_processes
worker_connections 10000;
use epoll;
#优化同⼀时刻只有⼀个请求⽽避免多个睡眠进程被唤醒的设置,on为防⽌被同时唤醒,默认为off,全部唤醒的过程也成为"惊群",因此nginx刚安装完以后要进⾏适当的优化。
accept_mutex on;
#Nginx服务器的每个⼯作进程可以同时接受多个新的⽹络连接,但是需要在配置⽂件中配置,此指令默认为关闭,即默认为⼀个⼯作进程只能⼀次接受⼀个新的⽹络连接,打开后⼏个同时接受多个。
multi_accept on;

}
- -

http段配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
http {
#导⼊⽀持的⽂件类型
include mime.types;
default_type application/octet-stream;


log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;
log_format access_json '{"@timestamp":"$time_iso8601",' #访问时间
'"host":"$server_addr",' #访问的nginx主机地址
'"clientip":"$remote_addr",' #访问nginx客户端地址
'"size":$body_bytes_sent,' #传输到客户端的字节数,不算响应头
'"responsetime":$request_time,' #处理请求的时间
'"upstreamtime":"$upstream_response_time",'
'"upstreamhost":"$upstream_addr",'
'"http_host":"$host",' #请求的主机名
'"uri":"$uri",' #uri
'"domain":"$host",'
'"xff":"$http_x_forwarded_for",' #如果用户是从CDN代理转发过来的会显示所有转发的地址
'"referer":"$http_referer",' #显示客户端从那个页面到来的
'"tcp_xff":"$proxy_protocol_addr",' #获取代理访问服务器的客户端地址,如果是直接访问,该值为空字符串
'"http_user_agent":"$http_user_agent",' #客户端信息
'"status":"$status"}'; #状态码
access_log logs/access.log access_json; #使用日志格式

# 第2阶段不等待
sendfile on;
# 场景: 在磁盘上有较⼤⽂件的场合,⽐如视频、⾳频等。当文件大于4M时不会使用sendfile, 不会磁盘加载到内核了,直接读磁盘。第1阶段和第2阶段均省略。
directio 4m;

# 在开启了sendfile的情况下,多个文件合并请求后统⼀发送给客户端。
# 场景: 高并发on减少开销。并发小on有延迟。
tcp_nopush off;

# ⽤asynchronous file I/O(AIO)功能,需要编译开启 --with-file-aio
aio on;


############# 长连接 start #############
# 设置会话保持时间,如果写俩个参数表示, 后面的参数会告诉客户端, 第1个是保持时间
keepalive_timeout 65 65;
# 连接后允许传输的最大文件数量 过小时,一个会话如果达到请求数量,nginx会主动断开连接,造成nginx端出现大量TIME_WAIT
keepalive_requests 2000;
# 在开启了keepalived模式下的连接是否启⽤TCP_NODELAY选项,当为off时,延迟0.2s发送,默认On时,不延迟发送,⽴即发送⽤户相应报⽂。
# 场景: 默认on 等0.2让数据包累积之后发送,高并发减少开销。并发小on有延迟。
tcp_nodelay off;
# 禁用ie6不建立长连接;
keepalive_disable msie6;
############# 长连接 stop #############



############# 压缩 start #############
gzip on;
gzip_comp_level 5;

# IE6 不压缩
gzip_disable "MSIE [1-6]\.";
# 即使http 1.0也支持压缩,默认1.1
gzip_http_version 1.0;

gzip_min_length 1k; # 至少1k文件才压缩
gzip_types text/plain application/json application/javascript application/x-javascript text/cssapplication/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
# 压缩打开时, 响应报⽂⾸部插⼊“Vary: Accept-Encoding”
gzip_vary on;
############# 压缩 stop #############

############# 上传优化 start #############

# 设置允许客⼾端上传单个⽂件的最⼤值,默认值为1m
# 如果上传大小超过nginx限制,nginx会返回 413 错误代码
client_max_body_size 1024m;
# 上传请求体大于16k默认值,会文件缓存
client_body_buffer_size 16k;
client_body_temp_path /apps/nginx/client_body_temp 1 2 2;
############# 上传优化 stop #############

############# 文件响应缓存 start #############
# 最大缓存10000个文件,非活动数据超时时长60s
open_file_cache max=10000 inactive=60s;

# 每间隔60s检查⼀下缓存数据有效性
open_file_cache_valid 60s;

# 60秒内⾄少被命中访问5次才被标记为活动数据; 没有5次就是非活动,60s过期。同时会被清理。
open_file_cache_min_uses 5;

# 缓存错误信息
open_file_cache_errors on;

############# 文件响应缓存 stop #############

############# 响应配置 start #############
# 流程 Client -> Nginx
# Nginx响应给客户端时,添加首部
add_header X-cache $upstream_cache_status;
add_header X-Via MageEdu;

# 安全
# 隐藏Nginx server版本。配置在http块中
server_tokens off;

############# 响应配置 stop #############

############# proxy_pass 相关代理配置 start #############
# 流程 Client -> Nginx Proxy -> Real Server
# 当前配置的是 Nginx Proxy -> Real Server

##### 建立连接 ===
# 建立连接版本
proxy_http_version 1.0;

# 建立连接超时,建立失败503
proxy_connect_timeout 60s;
# 读请求的超时, 如果后端mysql查询时间太长, 默认值就会让nginx给用户响应502.
proxy_read_timeout 60s;
# 写请求的超时, 如果后端mysql写入时间太长, 默认值就会让nginx给用户响应502.
proxy_send_timeout 60s;
##### 建立连接 === ~~~

##### 传递首部 ===
# 后端apache: /etc/httpd/conf/httpd.conf LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{UserAgent}i\"" combined 其中%{}i 表示引用HTTP首部
# 后端nginx: /apps/nginx/conf/nginx.conf "$http_x_forwarded_for"' #默认⽇志格式就有此配置 http_开头表示引用HTTP首部

# 场景1: 后端需要真实的客户端IP
# Client -> Nginx Proxy -> Real Server(apache, Nginx)
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
# Client -> Nginx Proxy1 -> Nginx Proxy2 -> Nginx Proxy2 -> Real Server(apache, Nginx)
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# 场景2: 后端nginx需要依据Host首部选择虚拟主机
proxy_set_header Host $host;


# 代理模式下,大量转发时,Ngx直接读缓存,直接转发。
# 当设定 proxy_set_header或hide_header,用于保存http报文header的hash表上限。
proxy_headers_hash_bucket_size 128;
# 设定 hash bucket size最大空间。字节
proxy_headers_hash_max_size 512;
# 保存server_name的hash表及上限。字节
server_names_hash_bucket_size 512;
server_names_hash_max_size 512;

##### 传递首部 === ~~~

##### 响应请求 ===
# 默认隐藏后端传递给客户端 “Date”, “Server”, “X-Pad”, and “X-Accel-...” 首部
# 额外定义隐藏,后端本身支持了跨域,nginx处也配置跨域时,需要把后端的跨域首部隐藏. proxy_hide_header Access-Control-Allow-Origin;
#proxy_hide_header field;
# 许可传递后端的首部,从代理服务器传递给客户端. 本来后端默认隐藏server, 现在许可传递Server, 当然这不安全。
#proxy_pass_header field;

# 场景: 客户端发起请求后,主动断开时,nginx如何处理? off,默认配置时, 大量的499表示"当前请求"后端响应慢,用户等的不耐烦了。后端太慢
# 默认off, nginx直接中断client连接,直接记录499响应码。但是后端还在处理请求。
# on表示nginx会忽略客户中断,一直等后端响应。要么200,要么超时502。
proxy_ignore_client_abort off;
##### 响应请求 === ~~~

##### 缓存响应 ===

# 以指定key缓存。默认$scheme$proxy_host$request_uri;
proxy_cache_key $request_uri;
# 定义对特定响应码的响应内容的缓存时⻓. 200 302 301 缓存10m分钟
# any表示除了200,302,301缓存1m.
proxy_cache_valid 200 302 301 10m;
proxy_cache_valid any 1m;

# 缓存的位置
# levels=1:2:2 缓存目录。1表示16进制0-f. 将文件md5从后向前取,第1个为1级子目录,第2-3为2级目录,第4-5为三级目录。加速查找
# proxycache:20m 缓存区域名,大小(主要用来存放key和metadata)
# inactive 缓存有效期
# max_size 占用磁盘空间大小,在inactive时间内,有效缓存, 看会有多少缓存。
proxy_cache_path /apps/nginx/cache/proxy_temp levels=1:2:2 keys_zone=proxycache:20m inactive=120s max_size=1g;


# 后端不可用使用缓存?不需要
# ngx_http_upstream_module 可以4层检查后端,不在线会自动下线。
# 后端全部挂了,zabbix有监控。
# proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;


##### 缓存响应 === ~~~


############# proxy_pass 相关代理配置 stop #############

############# fastcgi_pass 相关代理配置 start #############
fastcgi_cache_key $request_uri;
fastcgi_cache_path /apps/nginx/cache/fastcgi_temp levels=1:2:2 keys_zone=fastcgicache:20m inactive=120s max_size=1g;
#fastcgi_cache_stale
fastcgi_cache_valid 200 302 301 10m;
fastcgi_cache_valid any 1m;
############# fastcgi_pass 相关代理配置 stop #############

# server 配置独立
include conf.d/*.conf;
}
- -
1
2
3
4
5
6
install -dv cache/{proxy_temp,fastcgi_temp}

[root@localhost ~]# which nginx
/apps/nginx/sbin/nginx
[root@localhost ~]# nginx -t
[root@localhost ~]# systemctl restart nginx
- -

server段配置

基本的web网站

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[root@localhost nginx]# cat /apps/nginx/conf/conf.d/default.conf 
server {
listen 80;
#listen 443 ssl;
#server_name blog.mykernel.cn www.mykernel.cn mykernel.cn;
# 证书
#ssl_certificate /apps/nginx/certs/4899578_mykernel.cn.pem;
# 私钥
#ssl_certificate_key /apps/nginx/certs/4899578_mykernel.cn.key;
# ssl缓存
#ssl_session_cache shared:sslcache:20m;
# 缓存失效
#ssl_session_timeout 10m;

location / {
#if ( $scheme ~* "http$") {
# rewrite ^(.*)$ https://mykernel.cn$1 permanent;
#}
root /apps/nginx/html/;
}

location ^~ /static/ {
expires 90d; #设置⽂件过期时间
}

location /statics { #旧版本程序中的请求路径需要重写请求路径后再响应给客户端,不需要在跳转⾄其他location
root /apps/nginx/html/;
index index.html;
rewrite ^/statics/(.*) /static/$1 break;
}
}
- -

ssl配置

1
install -dv /apps/nginx/certs
- -

准备ca

-
1
2
3
private_key=ca.key
certificate=ca.pem
openssl req -x509 -sha256 -days 1825 -newkey rsa:2048 -keyout $private_key -out $certificate -nodes -subj '/C=CN/ST=SC/L=CD/O=OPS/OU=OPS/CN=ca.mykernel.cn' -verbose
- -

准备自己的公钥和秘钥

-
1
2
openssl req -newkey rsa:4096 -keyout blog.mykernel.key -out blog.mykernel.csr  \
-nodes -days 365 -subj '/C=CN/ST=SC/L=CD/O=OPS/OU=OPS/CN=blog.mykernel.cn' -verbose
- -

签发多域名证书 domain.ext

-
1
2
3
4
5
6
basicConstraints=CA:FALSE
subjectAltName = @alt_names
[alt_names]
DNS.1 = mykernel.cn
DNS.2 = www.mykernel.cn
DNS.3 = blog.mykernel.cn
- -
1
openssl x509 -req -CA $certificate  -CAkey $private_key -in blog.mykernel.csr -out blog.mykernel.crt -days 365 -CAcreateserial -extfile domain.ext
- -

查看证书

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@localhost ~]# openssl x509 -in blog.mykernel.crt -noout -text | grep  -E -C 3 'Subject|Issuer'
Serial Number:
fb:a6:13:f3:7a:05:4c:ac
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=CN, ST=SC, L=CD, O=OPS, OU=OPS, CN=ca.mykernel.cn # 签发
Validity
Not Before: Jul 9 09:53:41 2022 GMT
Not After : Jul 9 09:53:41 2023 GMT
Subject: C=CN, ST=SC, L=CD, O=OPS, OU=OPS, CN=blog.mykernel.cn
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (4096 bit)
Modulus:
--

X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Alternative Name:
DNS:mykernel.cn, DNS:www.mykernel.cn, DNS:blog.mykernel.cn # 多子域名
Signature Algorithm: sha256WithRSAEncryption
25:91:57:9d:d2:00:1f:a6:3c:e6:d9:06:7d:ff:bd:e1:1c:a6:
- -
1
[root@localhost ~]# cp blog.mykernel.crt blog.mykernel.key /apps/nginx/certs/
- -
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 80;
listen 443 ssl;
server_name blog.mykernel.cn www.mykernel.cn mykernel.cn;
# 证书
ssl_certificate /apps/nginx/certs/blog.mykernel.crt;
# 私钥
ssl_certificate_key /apps/nginx/certs/blog.mykernel.key;
# ssl缓存
ssl_session_cache shared:sslcache:20m;
# 缓存失效
ssl_session_timeout 10m;

location / {
if ( $scheme ~* "http$") {
rewrite ^(.*)$ https://blog.mykernel.cn$1 permanent;
}
root /apps/nginx/html/;
index index.html;
try_files $uri/index.html /index.html =404;
}
}
- -

准备域名

-
1
echo '127.0.0.1  blog.mykernel.cn mykernel.cn www.mykernel.cn' >> /etc/hosts
- -
1
curl --cacert /root/ca.pem -L www.mykernel.cn
- -

alias

1
2
3
4
5
6
7
8
9
location /about {
root /data/nginx/html/; #必须要在cp⽬录中创建⼀个about⽬录才可以访问,否则报错。
index index.html;
}

location /about {
alias /data/nginx/html/abc; #当访问about的时候,会显示alias定义的/data/nginx/html/pc⾥⾯的内容。
index index.html;
}
- -

location优先级

1
2
3
4
5
6
7
8
9
10
=
^~ 前缀
~* 不区分大小写
~ 区分大小写
普通路径匹配 /


# 其他字段
$ 结尾
\ 转义
- -

访问控制

4层

1
2
3
4
5
6
7
location /admin {
alias /data/nginx/html/admin;
index index.html;
allow 192.168.10.1;
deny 10.0.0.0/16;
deny all; #先允许⼩部分,再拒绝⼤部分
}
- -

7层

1
2
3
4
5
6
location = /login {
root /data/nginx/html;
index index.html;
auth_basic "login password";
auth_basic_user_file /apps/nginx/conf/.htpasswd;
}
- -

准备认证文件

-
1
2
3
4
# httpd-tools
# apache2-utils
htpasswd -cbm /apps/nginx/conf/.htpasswd user1 123456
htpasswd -bm /apps/nginx/conf/.htpasswd user2 123456
- -

自定义错误

1
2
3
4
5
6
7
8
9
10
server  {
error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
- -

自定义访问日志

1
2
3
4
5
server {
server_name mykernel.cn;
access_log /data/nginx/logs/mykernel.cn_access.log; #访问日志
error_log /data/nginx/logs/mykernel.cn_error.log; #错误日志
}
- -

检查文件是否存在

1
2
3
4
5
6
location / {
root /apps/nginx/html/;
index index.html;
#echo $uri;
try_files $uri/index.html /index.html =404;
}
- -

下载服务器

1
2
[root@localhost html]# cd /apps/nginx/html/download/
[root@localhost download]# touch centos{7,8} ubuntu{7,8}
- -
1
2
3
4
5
6
7
8
9
10
location /download {
# ⾃动索引功能
autoindex on;
# 计算⽂件确切⼤⼩(单位bytes),off只显示⼤概⼤⼩(单位kb、mb、gb)
autoindex_exact_size on;
# 显示本机时间⽽⾮GMT(格林威治)时间
autoindex_localtime on;
root /apps/nginx/html/;
limit_rate 10k;
}
- -

image-20220709173501413

-

nginx状态页

1
2
3
4
5
6
location /nginx_status {
stub_status;
#allow 192.168.10.1;
allow 127.0.0.1;
deny all;
}
- -
1
2
3
4
5
[root@localhost ~]# curl localhost/nginx_status
Active connections: 1
server accepts handled requests
29 29 29
Reading: 0 Writing: 1 Waiting: 0
- -
1
2
3
4
5
6
7
# Active connections:# 在线用户和空闲线程
# accepts: 接受的客户端请求的总数
# handled: 处理完成的客户端请求的总数, 一般和接受一样,除非是worker_connections限制等被拒绝的连接。
# requests: 客户端发来的总的请求数
# Reading: 正在读取客户端请求报⽂⾸部的连接数
# Writing: 正在向客户端发送响应报⽂过程中的连接数
# Waiting: 正在等待客户端发出请求的空闲连接数,开启 keep-alive的情况下,这个值等于active – (reading+writing),
- - -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
- - -
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-40-23-image.png" "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-40-23-image.png" index e76329e..571c1c7 100644 Binary files "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-40-23-image.png" and "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-40-23-image.png" differ diff --git "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-46-59-image.png" "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-46-59-image.png" index 05c2c50..3b50af6 100644 Binary files "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-46-59-image.png" and "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-10-46-59-image.png" differ diff --git "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-11-16-12-image.png" "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-11-16-12-image.png" index e8a3bc2..8964bc0 100644 Binary files "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-11-16-12-image.png" and "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-11-16-12-image.png" differ diff --git "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-12-26-43-image.png" "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-12-26-43-image.png" index acf3b61..8f79e47 100644 Binary files "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-12-26-43-image.png" and "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-12-26-43-image.png" differ diff --git "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-14-06-14-image.png" "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-14-06-14-image.png" index 0268123..de1d4f3 100644 Binary files "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-14-06-14-image.png" and "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/2022-09-23-14-06-14-image.png" differ diff --git "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/index.html" "b/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/index.html" deleted file mode 100644 index 0853de1..0000000 --- "a/2022/09/24/powershell\345\237\272\347\241\200\345\222\214\345\272\224\347\224\250/index.html" +++ /dev/null @@ -1,825 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Powershell基础和应用 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -
-
-
-
-
-
-
- -

Powershell基础和应用

- -
-

2022-09-23-10-40-23-image

-

这本书,重点是教会我们如何 通过自学掌握所有这些可以通过 PowerShell 操作的服务器级别产品。Exchange Server、SQL Server、System Center

-

而不是告诉我们每个产品怎么使用

-

自学的技巧

不要害怕失败,希望你有一台虚拟机,然后在虚拟里实验 PowerShell。学生们经常会问类似这类问题:“如果我做了这个和那个,会发生什么?”我们的回答往往是“不知道,自己试试”。在虚拟机做实验是一个好办法,最坏的情况也只不过是将虚拟机回滚到某个快照点,对吧?所以无论做什么,都请试一试。

-

不要害怕使用帮助并确保阅读示例。我们不止一次强调过这一点,但好像没人愿意听。我们仍然会看到很多学生在我们眼皮底下使用 Google 寻找示例。为什么那么害怕帮助文档?如果你都愿意读别人的博客了,为什么不先尝试在帮助文档中阅读示例?

-

请注意,在屏幕上,每一点信息可能都非常重要——请不要跳过不是你目前正在寻找的信息。你很容易这样做,但请不要这么做。要查看每一部分信息,并尝试发现该信息的用处,以及使用该信息能够推算出什么。

-

如果尝试一种方法不奏效,不要挠墙——请尝试其他方法。

-

终端

2022-09-23-10-46-59-image

-

PS C:\Windows\system32>

-

PS: powershell, 后面是当前工作目录

-

命令

认识命令

powershell 中叫 cmdlet,例如一个简单的列出当前目录下的所有文件

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PS C:\Windows\system32> cd c:/
PS C:\> ls


目录: C:\


Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2022/9/19 9:22 2020-09-16-myblog
d----- 2022/4/29 13:48 pcwlenv
d-r--- 2022/9/21 8:43 Program Files
d-r--- 2022/7/14 9:30 Program Files (x86)
d----- 2022/7/19 8:34 Temp
d-r--- 2022/9/21 12:27 Users
d----- 2022/7/29 8:21 Windows
-a---- 2022/4/29 13:42 0 dcdspdbg.log
-a---- 2022/7/12 11:31 12288 DumpStack.log
-a---- 2022/8/11 12:56 2637 priv.pfx


PS C:\> ls -name
2020-09-16-myblog
pcwlenv
Program Files
Program Files (x86)
Temp
Users
Windows
dcdspdbg.log
DumpStack.log
priv.pfx
- -

或者

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
PS C:\> Get-ChildItem


目录: C:\


Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2022/9/19 9:22 2020-09-16-myblog
d----- 2022/4/29 13:48 pcwlenv
d-r--- 2022/9/21 8:43 Program Files
d-r--- 2022/7/14 9:30 Program Files (x86)
d----- 2022/7/19 8:34 Temp
d-r--- 2022/9/21 12:27 Users
d----- 2022/7/29 8:21 Windows
-a---- 2022/4/29 13:42 0 dcdspdbg.log
-a---- 2022/7/12 11:31 12288 DumpStack.log
-a---- 2022/8/11 12:56 2637 priv.pfx


PS C:\> Get-ChildItem -Name
2020-09-16-myblog
pcwlenv
Program Files
Program Files (x86)
Temp
Users
Windows
dcdspdbg.log
DumpStack.log
priv.pfx
- -

注意,这里,可以发现命令lsGet-ChildItem是一样的作用,这里和 Linux 不一样

-
    -
  1. windows 中,为了兼容 linux 命令,部分与 linux 一样的命令, 例如 ls, 只是 windows 命令的别名(windows 别名只能引用命令本身,不能引用命令+选项。ls 只能对应 get-childitem)

    -
  2. -
  3. windows 中, 字符不区分大小写。LS, Ls, lS, 均是 ls 命令。get-childitem 还是 Get-CHILDITEM 均一样。为了方便书写,统一小写。

    -
  4. -
  5. windows 中也支持 tab 键补全命令,选项,目录路径

    -
  6. -
  7. windows 中终端也支持 ctrl + a, ctrl + e, ctrl + l。需要打开终端功能。Set-PSReadLineOption -EditMode emacs, 这个命令在会话中执行只是当前会话有效,终端重启之后就无效了,所以需要写在配置文件中,windows 在会话启动时,会读取的配置文件. $PSHOME -> $PROFILE

    -
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    $PSHOME
    profile.ps1
    Microsoft.PowerShell_profile.ps1

    (SPLIT-PATH $PROFILE)
    profile.ps1
    Microsoft.PowerShell_profile.ps1

    # 验证方式

    ## 会话启动时,定义变量

    set-content $PSHOME/Microsoft.PowerShell_profile.ps1 -value "'PSHOME MPS'`n[System.Environment]::SetEnvironmentVariable('PATH',`$Env:PATH+';;C:\Users\slc\apps\go-ipfs-v0.12.2\go-ipfs')"

    ## 会话启动时,定义别名。

    set-content $PSHOME/profile.ps1 -value "'PSHOME PS'`nNew-Alias ifconfig ipconfig"

    ## 会话启动时,定义变量

    set-content "$(Split-Path $PROFILE -Parent)/Microsoft.PowerShell_profile.ps1" -value "'profile MPS'`n[System.Environment]::SetEnvironmentVariable('PATH',`$Env:PATH+';;C:\Users\slc\apps\go-ipfs-v0.12.2\go-ipfs')"

    ## 会话启动时,也可以定义PS提示符变量,运行命令等等

    set-content "$(Split-Path $PROFILE -Parent)/profile.ps1" -value "'profile PS'`nSet-PSReadLineOption -EditMode emacs`nfunction prompt() { (get-date).ToShortTimeString() + ' [PS] ' + (Get-Location) + ' :> ' }`nNew-NetFirewallRule -DisplayName '9000 django test' -Direction Inbound -LocalPort 9000 -Protocol tcp -Action Allow`n"
    - -

    2022-09-23-11-16-12-image

    -
  8. -
  9. 由 4 中给配置文件,会话启动前会加载一些文件.

    -
  10. -
-

我们配置配置环境变量时,引用当前命令读的环境变量不是$path 而是$env:path

-

我们在文本中,需要换行,linux 是\n, \e, \t 。windows 对应

-
1
2
3
4
`n
`e
`t
...
- -

从以上示例,我们可以看出 windows 命令的格式

-

Get-ChildItem -Name

-
    -
  • 命令: get-childitem, 动词-名词

    -
      -
    • 获取 windows 支持哪些动作get-verb, 常用的动作就是 C (new) U (set) R (get) D (remove)
    • -
    -
  • -
  • 选项: -name, 帮助中获取

    -
  • -
-

命令帮助

如何知道 windows 上有哪些命令,show-command,会显示所有模块所有命令。

-

搜索命令, powershell 有文档维护自己的所有命令和模块对应的命令。即使你的系统没有安装这个命令,我们也可以搜索到命令及帮助。

-

首先,一个系统我们需要安装帮助文件,或者是系统的帮助文件是需要定时更新的。

-
1
Update-Help
- -
-

帮助可以自己手工联网更新,也可以离线更新。

-
-

更新帮助后,我们可以搜索一些命令相关的帮助的主题。例如:

-
-

user, privilege 权限,process 进程,net 网络,常用的关键字

-
-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 进程相关
12:13 [PS] C:\Windows\system32 :> help *process*

Name Category Module Synopsis
---- -------- ------ --------
Enter-PSHostProcess Cmdlet Microsoft.PowerShell.Core Connects to and enters into an interactive session with a local process.
Exit-PSHostProcess Cmdlet Microsoft.PowerShell.Core Closes an interactive session with a local process.
Get-PSHostProcessInfo Cmdlet Microsoft.PowerShell.Core Gets process information about the PowerShell host.
Debug-Process Cmdlet Microsoft.PowerShell.M... Debugs one or more processes running on the local computer.
Get-Process Cmdlet Microsoft.PowerShell.M... Gets the processes that are running on the local computer or a remote computer.
Start-Process Cmdlet Microsoft.PowerShell.M... Starts one or more processes on the local computer.
Stop-Process Cmdlet Microsoft.PowerShell.M... Stops one or more running processes.
Wait-Process Cmdlet Microsoft.PowerShell.M... Waits for the processes to be stopped before accepting more input.
Get-AppvVirtualProcess Function AppvClient ...
Start-AppvVirtualProcess Function AppvClient ...
ConvertTo-ProcessMitigationPolicy Cmdlet ProcessMitigations ConvertTo-ProcessMitigationPolicy...
Get-ProcessMitigation Cmdlet ProcessMitigations Get-ProcessMitigation...
Set-ProcessMitigation Cmdlet ProcessMitigations Set-ProcessMitigation...
- -
    -
  • name, process 相关的命令

    -
  • -
  • category,命令类型。windows 中一般有 cmdlet 命令,函数命令,….

    -
      -
    • cmdlet 命令,原生的 ps 命令,由.net 编写,google 搜索 cmdlet 关键字,返回结果主要关于 powershell 的。

      -
    • -
    • Function 函数,其实使用方式和 cmdlet 命令一样,只是不由.net 编写,而且 powershell 自己的脚本语言编写。

      -
    • -
    • Application: windows 的应用程序

      -
    • -
    -
  • -
  • Module,命令属于哪些模块

    -
      -
    • 查看所有模块 Get-Module -ListAvailable ,查看安装的模块Get-Module

      -

      命令是属于模块的,所以安装的模块对应的命令就是我们可以使用的 cmdlet 命令。

      -
      1
      2
      3
      4
      5
      6
      7
      8
      12:48 [PS] C:\Windows\system32 :>  Get-Module

      ModuleType Version Name ExportedCommands
      ---------- ------- ---- ----------------
      Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
      Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
      Manifest 2.0.0.0 NetSecurity {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal, New-NetIPsecQuickModeCryptoProposal...}
      Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}
      - -

      12:49 [PS] C:\Windows\system32 :> Get-Command -Module Microsoft.PowerShell.Management

      -
      1

    • -
    -
  • -
  • Synops,就是描述。

    -
  • -
-

现在我们可以看到,动作及命令,我们现在需要看看有哪些进程

-
1
2
3
4
5
6
7
8
 Get-Process
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
424 33 18192 21976 14.94 12280 1 360EntMsgCenter
3167 235 448632 73704 571.95 9948 1 360tray
284 14 15136 19204 93.17 5236 0 audiodg
345 26 29412 32084 0.19 5172 1 CefSharp.BrowserSubprocess
481 32 124300 38740 0.22 12404 1 CefSharp.BrowserSubprocess
- -

如何拿到 notepad 相关的进程?

-

linux 中,ps -ef | grep get-process ,对于过滤,我们使用文本处理三剑客 grep/awk/sed,进行过滤处理,即可。 linux 的输出 是文本。

-

而 windows 中,过滤,我们不需要这些文本处理工具。他的输出是一个个对象的集合。所以以上 get-process 的输出其实是一行行对象(不看第 1 列),列就是对象的属性。所以过滤其实就是过滤对象的属性值。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 先启动一个notepad, powershell中运行
notepad

# 过滤对象的属性,这里的name,就是对象的属性。 ?表示匹配, name属性。-match正则匹配。notepad是值
12:18 [PS] C:\Windows\system32 :> Get-Process | ? name -Match notepad

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
684 35 47252 65960 0.48 17848 1 Notepad
676 35 47476 60208 1.27 21288 1 Notepad


# 如何知道这1行行对象的属性有哪些 ?
12:19 [PS] C:\Windows\system32 :> Get-Process | gm


TypeName:System.Diagnostics.Process

Name MemberType Definition
---- ---------- ----------
Handles AliasProperty Handles = Handlecount
Name AliasProperty Name = ProcessName
- -

过滤某个进程,可以按对象过滤,还有一种方式,就是命令自带的过滤。一般 windows 命令均会自带过滤的参数。

-

如何看命令的选项及参数?

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 命令的帮助
# help command
12:20 [PS] C:\Windows\system32 :> help Get-Process

名称
Get-Process

摘要
Gets the processes that are running on the local computer or a remote computer.


语法
Get-Process [[-Name] <System.String[]>] [-ComputerName <System.String[]>] [-FileVersionInfo] [-Module] [<CommonParameters>]

Get-Process [-ComputerName <System.String[]>] [-FileVersionInfo] -Id <System.Int32[]> [-Module] [<CommonParameters>]

Get-Process [-ComputerName <System.String[]>] [-FileVersionInfo] -InputObject <System.Diagnostics.Process[]> [-Module] [<CommonParameters>]

Get-Process -Id <System.Int32[]> -IncludeUserName [<CommonParameters>]

Get-Process [[-Name] <System.String[]>] -IncludeUserName [<CommonParameters>]

Get-Process -IncludeUserName -InputObject <System.Diagnostics.Process[]> [<CommonParameters>]


说明
The `Get-Process` cmdlet gets the processes on a local or remote computer.

Without parameters, this cmdlet gets all of the processes on the local computer. You can also specify a particular process by process name or process ID (PID) or pass a process object through the pipeline to this cmdlet.

By default, this cmdlet returns a process object that has detailed information about the process and supports methods that let you start and stop the process. You can also use the parameters of the `Get-Process` cmdlet to get file v
ersion information for the program that runs in the process and to get the modules that the process loaded.


相关链接
Online Version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/get-process?view=powershell-5.1&WT.mc_id=ps-gethelp
Debug-Process
Get-Process
Start-Process
Stop-Process
Wait-Process

备注
若要查看示例,请键入: "get-help Get-Process -examples".
有关详细信息,请键入: "get-help Get-Process -detailed".
若要获取技术信息,请键入: "get-help Get-Process -full".
有关在线帮助,请键入: "get-help Get-Process -online"
- -

在帮助中,我们可以看到有几个段

-
    -
  • 名称

    -
  • -
  • 摘要,命令的功能

    -
  • -
  • 语法,命令的使用方式

    -
  • -
  • 说明

    -
  • -
  • 相关链接

    -
  • -
  • 备注,获取其他帮助**

    -
  • -
-

这几个段和 Linux 是类似的,一般我们着重看摘要和语法。语法部分,我们只需要注意[] 是可以省略的。<>是必给的。string[]表示数组,元素为一个个字符串。number[], 数组,元素为一个个数字。[<Common-Parameters>] 表示所有 powershell 命令通用的参数。 help about_CommonParameters 这样获取相关的参数。

-

还有一个重点,是备注。一般一个命令不会使用,可以以下步骤

-
1
2
3
4
5
6
7
8
# 看看命令的功能和语法
help Get-Process

# 看看命令的示例
help Get-Process -Examples

# 示例不够详细,也可以看看在线的文档。会自动打开网页,进入命令的帮助页。还是中文
help Get-Process -Online
- -

例如,我们看到的在线文档的帮助。这个合作怎么使用,已相当完整了。

-

2022-09-23-12-26-43-image

-

模块命令

一般使用一个产品,会提供 powershell 相应模块,我们只需要加载模块,就可以看到模块的命令。

-

powershell 获取命令帮助的第 2 种方法get-command,他有 2 个可选参数对应动作-verb, 名称-noun 支持通配。帮助的种类-CommandType。哪些模块-module

-

先看看帮助help get-command

-
1
2
3
Get-Command [[-Name] <System.String[]>] [[-ArgumentList] <System.Object[]>] [-All] [-CommandType {Alias | Function | Filter | Cmdlet | ExternalScript | Application | Script | Workflow | Configuration | All}] [-FullyQualifiedModule <
Microsoft.PowerShell.Commands.ModuleSpecification[]>] [-ListImported] [-Module <System.String[]>] [-ParameterName <System.String[]>] [-ParameterType <System.Management.Automation.PSTypeName[]>] [-ShowCommandInfo] [-Syntax] [-TotalCo
unt <System.Int32>] [<CommonParameters>]
- -
1
2
Get-Command [[-ArgumentList] <System.Object[]>] [-All] [-FullyQualifiedModule <Microsoft.PowerShell.Commands.ModuleSpecification[]>] [-ListImported] [-Module <System.String[]>] [-Noun <System.String[]>] [-ParameterName <System.Strin
g[]>] [-ParameterType <System.Management.Automation.PSTypeName[]>] [-ShowCommandInfo] [-Syntax] [-TotalCount <System.Int32>] [-Verb <System.String[]>] [<CommonParameters>]
- -

这里有 2 个语法,

-

get-command string[] 表示获取字符串列表的所有命令

-

get-command object[]

-

例如,获取 ls, cat 命令

-
1
2
3
4
5
6
7
8
9
10
11
12
13
12:54 [PS] C:\Windows\system32 :>  Get-Command ls,cat

CommandType Name Version Source
----------- ---- ------- ------
Alias ls -> Get-ChildItem
Alias cat -> Get-Content


12:55 [PS] C:\Windows\system32 :> Get-Command ls

CommandType Name Version Source
----------- ---- ------- ------
Alias ls -> Get-ChildItem
- -

windows 中,兼容 linux 的命令,可以从这里看出是别名,如何知道 windows 有哪些别名?

-
1
2
3
4
5
6
7
8
9
10
11
12
13
# 别名相关的主题?
12:56 [PS] C:\Windows\system32 :> help *alias*

Name Category Module Synopsis
---- -------- ------ --------
Export-Alias Cmdlet Microsoft.PowerShell.U... Exports information about currently defined aliases to a file.
Get-Alias Cmdlet Microsoft.PowerShell.U... Gets the aliases for the current session.
Import-Alias Cmdlet Microsoft.PowerShell.U... Imports an alias list from a file.
New-Alias Cmdlet Microsoft.PowerShell.U... Creates a new alias.
Set-Alias Cmdlet Microsoft.PowerShell.U... Creates or changes an alias for a cmdlet or other command in the current PowerShell session.
Get-ModuleAliases Function AdminToolbox ...
about_Aliases HelpFile
about_Alias_Provider HelpFile
- -
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 可以看到 get-alias
12:57 [PS] C:\Windows\system32 :> help get-alias

名称
Get-Alias

摘要
Gets the aliases for the current session.


语法
Get-Alias [-Definition <System.String[]>] [-Exclude <System.String[]>] [-Scope <System.String>] [<CommonParameters>]

Get-Alias [[-Name] <System.String[]>] [-Exclude <System.String[]>] [-Scope <System.String>] [<CommonParameters>]
- -
1
2
3
4
5
6
7
8
9
10
11
12
13
12:57 [PS] C:\Windows\system32 :>  get-alias

CommandType Name Version Source
----------- ---- ------- ------
Alias % -> ForEach-Object
Alias ? -> Where-Object
Alias ac -> Add-Content
Alias asnp -> Add-PSSnapin
Alias cat -> Get-Content
Alias cd -> Set-Location
Alias CFS -> ConvertFrom-String 3.1.0.0 Microsoft.PowerShell.Utility
Alias chdir -> Set-Location
Alias clc -> Clear-Content
- -

这样我们就拿到了 powershell 会话的所有别名

-

现在获取 get-childitem 命令

-
    -
  1. 直接给命令

    -
  2. -
  3. 给动作,匹配相关的名称

    -
  4. -
-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
12:58 [PS] C:\Windows\system32 :>  Get-Command get-childitem

CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-ChildItem 3.1.0.0 Microsoft.PowerShell.Management


12:59 [PS] C:\Windows\system32 :> Get-Command -Verb get -Noun *item*

CommandType Name Version Source
----------- ---- ------- ------
Function Get-DAEntryPointTableItem 1.0.0.0 DirectAccessClientComponents
Function Get-SFTPChildItem 3.0.6 Posh-SSH
Function Get-TestDriveItem 3.4.0 Pester
Cmdlet Get-ChildItem 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ControlPanelItem 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Item 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ItemProperty 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ItemPropertyValue 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-SCPItem 3.0.6 Posh-SSH
Cmdlet Get-SFTPItem 3.0.6 Posh-SSH
- -

这里可以看出,get-childitem 命令来自Microsoft.PowerShell.Management 模块。

-

查看这个模块对应的命令

-
1
Get-Command -Module Microsoft.PowerShell.Management
- -

查看这个模块对应的 get 命令

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
13:01 [PS] C:\Windows\system32 :>  Get-Command -Module Microsoft.PowerShell.Management -Verb get

CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-ChildItem 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Clipboard 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ComputerInfo 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ComputerRestorePoint 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Content 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ControlPanelItem 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-EventLog 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-HotFix 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Item 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ItemProperty 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-ItemPropertyValue 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Location 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Process 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-PSDrive 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-PSProvider 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-TimeZone 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Transaction 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-WmiObject 3.1.0.0 Microsoft.PowerShell.Management
- -

查看这个模块 get 命令,其中时间相关的命令

-
1
2
3
4
5
13:02 [PS] C:\Windows\system32 :>  Get-Command -Module Microsoft.PowerShell.Management -Verb get -Noun *time*

CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-TimeZone 3.1.0.0 Microsoft.PowerShell.Management
- -

安装命令

仓库

1
2
3
4
5
13:03 [PS] C:\Windows\system32 :>  Get-PSRepository

Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Trusted https://www.powershellgallery.com/api/v2
- -
    -
  • 这个 psrepo 相关的操作,通过以上的帮助来探索即可

    -
  • -
  • 配置仓库,修改仓库,删除仓库….

    -
  • -
-

搜索软件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
13:05 [PS] C:\Windows\system32 :>  help *module*                                                                                                                                                                                                                                                                                                                                                                                                                                          Name                              Category  Module                    Synopsis
---- -------- ------ --------
ImportSystemModules Function ...
Find-Module Function PowerShellGet ...
Get-InstalledModule Function PowerShellGet ...
Install-Module Function PowerShellGet ...
Publish-Module Function PowerShellGet ...
Save-Module Function PowerShellGet ...
Uninstall-Module Function PowerShellGet ...
Update-Module Function PowerShellGet ...
Update-ModuleManifest Function PowerShellGet ...
Export-ModuleMember Cmdlet Microsoft.PowerShell.Core Specifies the module members that are exported.
Get-Module Cmdlet Microsoft.PowerShell.Core List the modules imported in the current session or that can be imported from the PSModulePath.
Import-Module Cmdlet Microsoft.PowerShell.Core Adds modules to the current session.
New-Module Cmdlet Microsoft.PowerShell.Core Creates a new dynamic module that exists only in memory.
New-ModuleManifest Cmdlet Microsoft.PowerShell.Core Creates a new module manifest.
Remove-Module Cmdlet Microsoft.PowerShell.Core Removes modules from the current session.
Test-ModuleManifest Cmdlet Microsoft.PowerShell.Core Verifies that a module manifest file accurately describes the contents of a module.
Get-ModuleAliases Function AdminToolbox ...
Get-CPowerShellModuleInstallPath Function Carbon ...
Test-ModuleLoaded Function core ...
InModuleScope Function Pester ...
about_Modules HelpFile
about_Module_Manifests HelpFile
about_PSModulePath HelpFile 
- -

可以看到有一个 find 命令,应该是查找命令相关的.

-

install,就表示安装命令

-

获取相应的帮助

-
1
help Find-Module -online
- -

查找 powershell 相关的模块

-
1
Find-Module  PowerShell*
- -

查找指定版本

-
1
find-module PowerShellGet -RequiredVersion 1.6.5
- -

在指定仓库内查找

-
1
Find-Module  PowerShellGet -Repository PSGallery
- -

基于 name, description, and tags 搜索相关的模块

-
1
Find-Module -Filter net
- -

基于 tag 搜索

-
1
Find-Module -Tag CrescendoBuilt
- -

例如我们搜索 kubernetes 搜索

-
1
2
3
4
5
6
7
8
13:20 [PS] C:\Windows\system32 :>  Find-Module kubernetes

Version Name Repository Description
------- ---- ---------- -----------
1.0.0 Kubernetes PSGallery Kubernetes


13:24 [PS] C:\Windows\system32 :> Install-Module Kubernetes
- -

查看安装的模块

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
13:25 [PS] C:\Windows\system32 :>  Get-InstalledModule

Version Name Repository Description
------- ---- ---------- -----------
11.0.3 AdminToolbox PSGallery Master module for a collection of modules. These modules are varied in their tasks. The overall purpose of them being to provide a powerfull Toolset to improve IT Ad...
1.8.0 AdminToolbox.ActiveDirectory PSGallery Functions for Active Directory
4.8.0 AdminToolbox.EndpointManagement PSGallery Functions for management of endpoints
1.9.0 AdminToolbox.Exchange PSGallery Functions for Exchange Management
4.12.0 AdminToolbox.FFTools PSGallery Expedite simple ffmpeg actions
1.13.0 AdminToolbox.FileManagement PSGallery File Management Functions
2.15.0 AdminToolbox.FortiWizard PSGallery Functions that generate configuration scripts and manage FortiOS.
1.6.0 AdminToolbox.Fun PSGallery Functions that have no purpose
1.2.0 AdminToolbox.MSGraph PSGallery Microsoft Graph interactive API Functions
2.13.0 AdminToolbox.Networking PSGallery Network Troubleshooting Functions
2.10.0 AdminToolbox.Office365 PSGallery Functions for working with Office365 and Azure modules
1.9.0 AdminToolbox.Remoting PSGallery Functions for remote management and access.
4.8.0 AdminToolbox.VMWareAutomate PSGallery Functions to Automate Bulk VMWare Tasks
2.11.3 Carbon PSGallery Carbon is a PowerShell module for automating the configuration Windows 7, 8, 2008, and 2012 and automation the installation and configuration of Windows applications...
1.9 core PSGallery Module with various generic functions that could be used in any script
1.0.2 Get-IPInfo PSGallery Quickly look up IP Information including location, ISP and Organization
7.8.0 ImportExcel PSGallery PowerShell module to import/export Excel spreadsheets, without Excel....
1.1.1 IPTools PSGallery This module offers a set of tools to manage IP networks and devices.
1.0.0 Kubernetes PSGallery Kubernetes
3.0.6 Posh-SSH PSGallery Provide SSH and SCP functionality for executing commands against remote hosts.
0.3.0.0 PoshPrivilege PSGallery Module designed to use allow easier access to work with User Rights (privileges)
1.3.1 ProgramManagement PSGallery This Module makes it easier to Install/Uninstall programs on Windows, regardless of the method of installation (PSGet, Chocolatey CmdLine, .msi, etc). GitHub: https:...
1.0.22 PSEventViewer PSGallery Simple module allowing parsing of event logs. Has its own quirks...
0.9.3 ud-netmon PSGallery Web-based GUI (PowerShell Universal Dashboard) that pings specified Remote Hosts on your Domain every 5 seconds. GitHub: https://github.com/pldmgg/UD-NetMon
2.1.1 WindowsKeyboardManagement PSGallery Allows keys on the physical keyboard to be remapped, and redefine programs associated with multimedia keys. For example, you can remap the "Scroll Lock" key to the
- -

导入模块

-
1
2
3
4
5
6
13:25 [PS] C:\Windows\system32 :>  Import-Module Kubernetes
13:25 [PS] C:\Windows\system32 :> Get-Module

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0.0 Kubernetes
- -

获取模块相关的命令

-
1
13:26 [PS] C:\Windows\system32 :>  Get-Command -Module Kubernetes
- -

远程执行命令

打开远程功能,

-
1
13:27 [PS] C:\Windows\system32 :>  Enable-PSRemoting
- -

功能打开后,会侦听  5985 端口

-
1
2
3
4
5
13:31 [PS] C:\Windows\system32 :>  Get-NetTCPConnection -State Listen -LocalPort 5985

LocalAddress LocalPort RemoteAddress RemotePort State AppliedSetting OwningProcess
------------ --------- ------------- ---------- ----- -------------- -------------
:: 5985 :: 0 Listen 4
- -

远程连接

-
1
Invoke-Command -ComputerName "192.168.13.103" -Credential (Get-Credential) { Get-ComputerInfo }
- -

提供者

psprovider,本质上是一个适配器,把一切都模拟成文件操作。统一使用 get-item, new-item, remove-item 来操作,适配器负责将这些操作转换成对应适配器后的操作。

-
1
2
3
4
5
6
7
8
9
10
11
12
13:35 [PS] C:\Windows\system32 :>  Get-PSProvider

Name Capabilities Drives
---- ------------ ------
Registry ShouldProcess, Transactions {HKLM, HKCU}
Alias ShouldProcess {Alias}
Environment ShouldProcess {Env}
FileSystem Filter, ShouldProcess, Credentials {C, D, E, F...}
Function ShouldProcess {Function}
Variable ShouldProcess {Variable}
WSMan Credentials {WSMan}
Certificate ShouldProcess {Cert}
- -

这里,有很多适配器,均可以通过一套接口操作。操作每个适配器,可以有多个操作入口,例如下面的文件系统,有 CDEFG,这些入口。注册表有 HKCU/HKLM。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
14:02 [PS] C:\Windows\system32 :>  Get-PSDrive

Name Used (GB) Free (GB) Provider Root CurrentLocation
---- --------- --------- -------- ---- ---------------
Alias Alias
C 112.18 8.23 FileSystem C:\ Windows\system32
Cert Certificate \
D 71.20 50.80 FileSystem D:\
E 40.41 81.59 FileSystem E:\
Env Environment
F 0.09 100.94 FileSystem F:\
Function Function
G 50.93 396.19 FileSystem G:\
HKCU Registry HKEY_CURRENT_USER
HKLM Registry HKEY_LOCAL_MACHINE
Variable Variable
WSMan WSMan
- -

例如查看 C:/盘的文件

-
1
2
3
4
5
6
7
8
9
10
11
14:05 [PS] C:\Windows\system32 :>  ls -Name c:/
2020-09-16-myblog
pcwlenv
Program Files
Program Files (x86)
Temp
Users
Windows
dcdspdbg.log
DumpStack.log
priv.pfx
- -

查看 hkcu 下的内容

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
14:05 [PS] C:\Windows\system32 :>  ls hkcu:/ -name
AppEvents
Console
Control Panel
Environment
EUDC
Keyboard Layout
Layout
Network
Printers
Software
System
Uninstall
Volatile Environment
wdsafeloadat
- -

2022-09-23-14-06-14-image

-

刚刚好,一一对应。

-

item 属性

一个项对应的属性。比如只读、项创建时间、长度等。

-

一般这个 item 是只读的,当提供是注册表时,是可以修改的。

-
1
2
3
4
5
6
7
8
9
10
11
12
14:29 [PS] C:\Windows\system32 :>  Get-Item HKCU:\Console\


Hive: HKEY_CURRENT_USER


Name Property
---- --------
Console ColorTable00 : 789516
ColorTable01 : 14300928
ColorTable02 : 958739
ColorTable03 : 14521914
- -

查看属性

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14:30 [PS] C:\Windows\system32 :>  Get-ItemProperty HKCU:\Console\


ColorTable00 : 789516
ColorTable01 : 14300928
ColorTable02 : 958739
ColorTable03 : 14521914
ColorTable04 : 2035653
ColorTable05 : 9967496
ColorTable06 : 40129
ColorTable07 : 13421772
ColorTable08 : 7763574
ColorTable09 : 16742459
- -

修改属性

-
1
Set-ItemProperty -Path "HKLM:\Software\ContosoCompany" -Name "NoOfEmployees" -Value 824
- -

item 操作

以 filesystem 为例

-

添加文件或目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
14:32 [PS] C:\Windows\system32 :>  new-item d:/test-2022-9-23


目录: D:\


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2022/9/23 14:38 0 test-2022-9-23


14:38 [PS] C:\Windows\system32 :> new-item -Type Directory d:/test-d


目录: D:\


Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2022/9/23 14:38 test-d
- -

注意,在行首的-, d,用来区别文件类型的。创建目录另一个mkdir

-

删除目录或目录

1
2
14:38 [PS] C:\Windows\system32 :>  Remove-Item d:/test-d
14:39 [PS] C:\Windows\system32 :> Remove-Item D:\test-2022-9-23
- -

进程管理

1
2
3
4
5
6
7
8
9
14:39 [PS] C:\Windows\system32 :>  Get-Command -Noun Process

CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Debug-Process 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Get-Process 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Start-Process 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Stop-Process 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Wait-Process 3.1.0.0 Microsoft.PowerShell.Management
- -

服务管理

1
2
3
4
5
6
7
8
9
10
11
12
13
14:40 [PS] C:\Windows\system32 :>  Get-Command -Noun Service

CommandType Name Version Source
----------- ---- ------- ------
Alias Remove-Service 2.11.3 Carbon
Cmdlet Get-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet New-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Restart-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Resume-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Set-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Start-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Stop-Service 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Suspend-Service 3.1.0.0 Microsoft.PowerShell.Management
- -

管道

由于 powershell 输出的均为对象,管道传递的是对象。linux 的管道传递的是字符串。

-

管道的对象修改仅在使用 ft/fl 之后

-

使用 select 可以将输出结果显示更少,或更多。默认显示有限,但是对象有很多的属性,为了完全显示,可以使用| select *

-
1
Get-Process notepad  | select *
- -

当选择所有字段,就会显示对象所有属性,一行显示不下,就会纵向显示。也可以显示更少的

-
1
2
3
4
5
6
14:49 [PS] C:\Windows\system32 :>  Get-Process notepad  | select name,id,cpu,VirtualMemorySize

Name Id CPU VirtualMemorySize
---- -- --- -----------------
Notepad 17848 0.5625 560594944
Notepad 21288 1.390625 564748288
- -

这里显示的改变了,但是每行还是对象。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
14:50 [PS] C:\Windows\system32 :>  Get-Process notepad  | select name,id,cpu,VirtualMemorySize | gm


TypeName:Selected.System.Diagnostics.Process

Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
CPU NoteProperty System.Double CPU=0.5625
Id NoteProperty int Id=17848
Name NoteProperty string Name=Notepad
VirtualMemorySize NoteProperty int VirtualMemorySize=560594944
- -

注意输出是TypeName:Selected.System.Diagnostics.Proc

-

更少的字段输出的是表格,我们显示列

-
1
2
3
4
5
6
7
8
9
10
11
12
14:51 [PS] C:\Windows\system32 :>  Get-Process notepad  | select name,id,cpu,VirtualMemorySize | fl


Name : Notepad
Id : 17848
CPU : 0.5625
VirtualMemorySize : 560594944

Name : Notepad
Id : 21288
CPU : 1.390625
VirtualMemorySize : 564748288
- -

显示列之后,对象就不存在了

-
1
2
3
4
14:51 [PS] C:\Windows\system32 :>  Get-Process notepad  | select name,id,cpu,VirtualMemorySize | fl | gm


TypeName:Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
- -

ft/fl 均一样

-

当 select 之后,我们还可以使用对象的操作,ft/fl 之后,就不能使用对象的操作了

-

select 之后,期望 name 显示为 processname

-
1
2
3
4
5
6
15:12 [PS] C:\Windows\system32 :>  Get-Process notepad  | select name,id,cpu,VirtualMemorySize

Name Id CPU VirtualMemorySize
---- -- --- -----------------
Notepad 17848 0.578125 560594944
Notepad 21288 1.390625 564748288
- -
1
2
3
4
5
6
15:14 [PS] C:\Windows\system32 :>  Get-Process notepad  | select @{L='ProcessName';E={$_.name} },id,cpu,VirtualMemorySize

ProcessName Id CPU VirtualMemorySize
----------- -- --- -----------------
Notepad 17848 0.578125 560594944
Notepad 21288 1.390625 564748288
- -

这里的修改显示字段名的语法可以使用在 select 中,@{L='ProcessName';E={$_.name} } L 是显示的名,E 是表达式,可以求值。值就是每行这个字段显示的值。

-

格式化

之前我们显示的表格,可以通过 select 来显示更少或更多字段

-

有 ft,可以显示为表格,fl 显示为列。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
14:54 [PS] C:\Windows\system32 :>  Get-Service

Status Name DisplayName
------ ---- -----------
Stopped AarSvc_503ac AarSvc_503ac
Stopped AJRouter AllJoyn Router Service
Stopped ALG Application Layer Gateway Service
Stopped AppIDSvc Application Identity
Running Appinfo Application Information
Stopped AppMgmt Application Management
Stopped AppReadiness App Readiness
Stopped AppVClient Microsoft App-V Client
Stopped AppXSvc AppX Deployment Service (AppXSVC)
Stopped AssignedAccessM... AssignedAccessManager 服务
Running AudioEndpointBu... Windows Audio Endpoint Builder
Running Audiosrv Windows Audio
Stopped autotimesvc 手机网络时间
- -

这里可以看出有...省略,说明没有显示完。我们可以添加选项显示完

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
14:54 [PS] C:\Windows\system32 :>  Get-Service | ft -AutoSize -Wrap

Status Name DisplayName
------ ---- -----------
Stopped AarSvc_503ac AarSvc_503ac
Stopped AJRouter AllJoyn Router Service
Stopped ALG Application Layer Gateway Service
Stopped AppIDSvc Application Identity
Running Appinfo Application Information
Stopped AppMgmt Application Management
Stopped AppReadiness App Readiness
Stopped AppVClient Microsoft App-V Client
Stopped AppXSvc AppX Deployment Service (AppXSVC)
Stopped AssignedAccessManagerSvc AssignedAccessManager 服务
- -

powershell 脚本编程

循环

1
2
3
4
5
for (($i = 0), ($j = 0); $i -lt 10; $i++, $j++)
{
"`$i:$i"
"`$j:$j"
}
- -

命令直接循环

-
1
2
3
4
5
6
7
8
9
10
11
14:46 [PS] C:\Windows\system32 :>  Get-Process notepad

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
655 33 47000 52196 0.56 17848 1 Notepad
676 35 47476 57476 1.39 21288 1 Notepad


14:46 [PS] C:\Windows\system32 :> Get-Process notepad | %{ $_.name }
Notepad
Notepad
- -
    -
  • 这里的%是 foreach 的别名,会遍历 每个对象。 {} 是语句块,是循环每个对象,其中引用每一个对象使用$_
  • -
-

选择

1
help about_If
- -

判断文件时,我们使用 test 表达式

-
1
2
3
4
5
6
7
14:56 [PS] C:\Windows\system32 :>  Get-Command -Verb test -Module Microsoft.PowerShell.Management

CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Test-ComputerSecureChannel 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Test-Connection 3.1.0.0 Microsoft.PowerShell.Management
Cmdlet Test-Path 3.1.0.0 Microsoft.PowerShell.Management
- -
1
2
14:57 [PS] C:\Windows\system32 :>  if(test-path d:/test) { '123' } else { 'not exist' }
not exist
- -

字符串替换

1
help about_Comparison_Operators
- -
1
2
14:57 [PS] C:\Windows\system32 :>  "hello world" -replace 'll\S\s','123'
he123world
- -
    -
  • 正则匹配,目标字符串
  • -
-

算术运算

1
help about_Arithmetic_Operators
- -

命令行可以直接进行一些算术操作

-
1
2
15:09 [PS] C:\Windows\system32 :>  1+2+3+4
10
- -

编写脚本

脚本策略

-
1
Set-ExecutionPolicy RemoteSigned
- -

RemoteSigned 表示 PowerShell可以运行本地任何脚本,同时也可以执行受信任的 CA 签发的数字证书签名之后的远程脚本。“远程脚本”是指存在于远端计算机上的脚本,经常通过通用命名规则(UNC)方式访问这些脚本。我们也会将那些来自于网络上的脚本称为“远程脚本”。Internet Explorer、Firefox 和 Outlook 中提供的可下载的脚本,我们均可视为来自网络的脚本。在某些版本的 Windows 中,会区分网络路径以及 UNC 路径。在这些场景中,本地网络中的 UNC 都不会认为是“远程”。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<#
.SYNOPSIS
从1个或多个计算机获取逻辑磁盘信息
.DESCRIPTION
使用WMI接口从1或多个主机获取, 可用空间大于50%的win32_logicaldisk实例。 显示磁盘驱动,空间空间,总大小,空闲百分比
.PARAMETER drivetype
磁盘类型,默认3
.PARAMETER gtfree
可用空间百分比
.PARAMETER computername
远程计算机名
.EXAMPLE
get-disk -computername localhost -drivetype 3 -gtfree 80
#>
[cmdletbinding()]
param (
[int]$drivetype = 3,
[int]$gtfree=50,
[Parameter(Mandatory=$true,HelpMessage="enter a or a set computer to query")]
[string]$computername
)

Get-WmiObject win32_logicaldisk -com $computername -filter "drivetype=$drivetype" | ? { ($_.freespace / $_.size * 100 ) -gt $gtfree} | select deviceid,
@{L='freesize(gb)';E={$_.freespace / 1gb -as [int]}},
@{L='size(gb)';E={$_.size / 1gb -as [int]}},
@{L='%free';E={ $_.freespace / $_.size *100 -as [int]}}
- -
    -
  1. <# #> 定义脚本的帮助。.KEYWORD 定义语法,变量对应的参数和值,和描述。 示例。powershell 会自动解析为, 帮助的各部分

    -
  2. -
  3. 参数段

    -
    1
    2
    3
    4
    5
    6
    7
    [cmdletbinding()]
    param (
    [int]$drivetype = 3,
    [int]$gtfree=50,
    [Parameter(Mandatory=$true,HelpMessage="enter a or a set computer to query")]
    [string]$computername
    )
  4. -
-

[cmdletbinding()] 固定语法在param()

-

$drivetype = 3 这个是定义变量,powershell 会自动解析为命令行参数,忽略大小写。 -drivetype, -drive, 可以简短格式,要求惟一

-

[int] [string]

-

[Parameter(Mandatory=$true,HelpMessage="enter a or a set computer to query")] 是参数检验,要求字符,要求整整型。要求必给,不给,交互式提示输入。

-
    -
  1. 脚本内容部分

    -
    1
    2
    3
    4
    Get-WmiObject win32_logicaldisk -com $computername -filter "drivetype=$drivetype" | ? { ($_.freespace / $_.size * 100 ) -gt $gtfree} | select deviceid,
    @{L='freesize(gb)';E={$_.freespace / 1gb -as [int]}},
    @{L='size(gb)';E={$_.size / 1gb -as [int]}},
    @{L='%free';E={ $_.freespace / $_.size *100 -as [int]}}
  2. -
-

这里就是命令,只是可变的部分已抽成参数。

-

执行

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
15:23 [PS] D:\ :>  .\test.ps1 -?

名称
D:\test.ps1

摘要
1个或多个计算机获取逻辑磁盘信息


语法
D:\test.ps1 [[-drivetype] <Int32>] [[-gtfree] <Int32>] [-computername] <St
ring> [<CommonParameters>]


说明
使用WMI接口从1或多个主机获取, 可用空间大于50%的win32_logicaldisk实例。 显
示磁盘驱动,空间空间,总大小,空闲百分比


相关链接

备注
若要查看示例,请键入: "get-help D:\test.ps1 -examples".
有关详细信息,请键入: "get-help D:\test.ps1 -detailed".
若要获取技术信息,请键入: "get-help D:\test.ps1 -full".
- -
1
2
D:\test.ps1 [[-drivetype] <Int32>] [[-gtfree] <Int32>] [-computername] <St
ring> [<CommonParameters>]
- -

说明每个参数均可以按位置传递参数。

-
1
2
3
4
5
6
7
8
9
10
11
12
15:23 [PS] D:\ :>  .\test.ps1

位于命令管道位置 1 的 cmdlet test.ps1
请为以下参数提供值:
(请键入 !? 以查看帮助。)
computername: localhost

deviceid freesize(gb) size(gb) %free
-------- ------------ -------- -----
E: 82 122 67
F: 101 101 100
G: 396 447 89
- -
-
-
- - -

- - 本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处! - -

- - -
-
- - -
- -
- -
- - - -
- - - - -
- - - - -
- -
-
-
-
- -
-
-

 TOC

-
-
- -
- -
-
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/404.html b/404.html deleted file mode 100644 index cffc4c2..0000000 --- a/404.html +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Page not found - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/archives/2022/05/index.html b/archives/2022/05/index.html deleted file mode 100644 index 1b460cf..0000000 --- a/archives/2022/05/index.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Archives - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
-
- -
-
-
- - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/archives/2022/06/index.html b/archives/2022/06/index.html deleted file mode 100644 index da429f6..0000000 --- a/archives/2022/06/index.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Archives - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
-
- -
-
-
- - -
-

7 posts in total.

-
- - - - -

2022

- - - Vmware安装系统 - - - -
- - - - - -
-
-
-
-
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/archives/2022/07/index.html b/archives/2022/07/index.html deleted file mode 100644 index 6173817..0000000 --- a/archives/2022/07/index.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Archives - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
-
- -
-
-
- - -
-

7 posts in total.

-
- - - - -

2022

- - - Nginx通用配置 - - - - - - Nginx-编译安装 - - - -
- - - - - -
-
-
-
-
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/archives/2022/index.html b/archives/2022/index.html deleted file mode 100644 index 692df9d..0000000 --- a/archives/2022/index.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Archives - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
- -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/archives/index.html b/archives/index.html deleted file mode 100644 index 2890eac..0000000 --- a/archives/index.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Archives - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
- -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/categories/index.html b/categories/index.html deleted file mode 100644 index 133c1d9..0000000 --- a/categories/index.html +++ /dev/null @@ -1,438 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Categories - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
-
- -
-
-
- - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/categories/\345\221\250\346\234\253\347\233\264\346\222\255\345\210\206\344\272\253/index.html" "b/categories/\345\221\250\346\234\253\347\233\264\346\222\255\345\210\206\344\272\253/index.html" deleted file mode 100644 index 38be726..0000000 --- "a/categories/\345\221\250\346\234\253\347\233\264\346\222\255\345\210\206\344\272\253/index.html" +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - Categories - 周末直播分享 - my blog - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- -
- -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git "a/categories/\344\270\252\344\272\272\346\200\273\347\273\223/index.html" "b/categories/\345\255\246\344\271\240\350\256\241\345\210\222/index.html" similarity index 89% rename from "categories/\344\270\252\344\272\272\346\200\273\347\273\223/index.html" rename to "categories/\345\255\246\344\271\240\350\256\241\345\210\222/index.html" index 91974c3..cd692a2 100644 --- "a/categories/\344\270\252\344\272\272\346\200\273\347\273\223/index.html" +++ "b/categories/\345\255\246\344\271\240\350\256\241\345\210\222/index.html" @@ -17,15 +17,15 @@ - - + + - Categories - 个人总结 - my blog + Categories - 学习计划 - my blog @@ -47,7 +47,7 @@ @@ -156,7 +156,7 @@