glass 4 meses atrás
pai
commit
3a81f1d1bd
6 arquivos alterados com 94 adições e 13 exclusões
  1. 3 12
      README.md
  2. 17 0
      centos.md
  3. 16 0
      debian.md
  4. 1 1
      nginx.md
  5. 43 0
      proxy-ip.conf
  6. 14 0
      proxy.md

+ 3 - 12
README.md

@@ -6,19 +6,10 @@
 
 > 如果已安装请跳过
 
+- [Debian中安装Docker](debian.md)
+- [CentOS中安装Docker](centos.md)
+
 ```
-apt update
-apt install -y ca-certificates curl unzip
-install -m 0755 -d /etc/apt/keyrings
-curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
-chmod a+r /etc/apt/keyrings/docker.asc
-
-echo \
-  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
-  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
-  tee /etc/apt/sources.list.d/docker.list > /dev/null
-apt update
-apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
 systemctl enable docker
 systemctl restart docker
 

+ 17 - 0
centos.md

@@ -0,0 +1,17 @@
+# CentOS中安装Docker
+
+## 添加阿里云镜像
+
+```
+curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
+yum clean all
+yum makecache
+```
+
+## 安装
+
+```
+yum install -y yum-utils
+yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
+yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
+```

+ 16 - 0
debian.md

@@ -0,0 +1,16 @@
+# Debian中安装Docker
+
+```
+apt update
+apt install -y ca-certificates curl unzip
+install -m 0755 -d /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
+chmod a+r /etc/apt/keyrings/docker.asc
+
+echo \
+  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
+  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
+  tee /etc/apt/sources.list.d/docker.list > /dev/null
+apt update
+apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
+```

+ 1 - 1
nginx.md

@@ -16,7 +16,7 @@ docker load -i nginx.tar
 
 ```
 docker run -d \
-    -p 80:80 -p 443:443 \
+    -p 80:80 -p 12345:80 -p 443:443 \
     --privileged=true \
     --restart=always \
     --network=local \

+ 43 - 0
proxy-ip.conf

@@ -0,0 +1,43 @@
+server {
+    listen 80;
+    server_name _;
+    
+    return 301 https://$host$request_uri;
+}
+
+server {
+    listen 443 ssl;
+    server_name _;
+
+    ssl_certificate      /etc/nginx/http.d/ip.crt;
+    ssl_certificate_key  /etc/nginx/http.d/ip.key;
+    ssl_session_timeout  5m;
+    ssl_protocols  TLSv1.2 TLSv1.3;
+    ssl_ciphers  HIGH:!aNULL:!MD5;
+    ssl_prefer_server_ciphers   on;
+
+    client_max_body_size 1024m;
+
+    location /group/signal {
+        proxy_pass https://im.whatup.cc;
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "upgrade";
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto $scheme;
+    }
+
+    location / {
+        proxy_ssl_server_name on;
+        proxy_ssl_verify off;
+
+        proxy_set_header Host $host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto https;
+        
+        proxy_pass https://im.whatup.cc;
+    }
+}

+ 14 - 0
proxy.md

@@ -4,10 +4,24 @@
 
 # 配置Nginx
 
+## 使用域名
+
 ```
 sed -i 's/SERVER_NAME/要配置的域名/g' proxy.conf
 docker cp proxy.conf nginx:/etc/nginx/http.d/
+```
+
+## 使用IP
+
+```
+docker cp proxy-ip.conf nginx:/etc/nginx/http.d/
+docker cp ip.crt nginx:/etc/nginx/http.d/
+docker cp ip.key nginx:/etc/nginx/http.d/
+```
 
+## 更新Nginx配置
+
+```
 docker exec -it nginx nginx -t
 docker exec -it nginx nginx -s reload
 ```