安装 Nginx Proxy Manager
安装 Docker-compose
1
| sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
1
| sudo chmod +x /usr/local/bin/docker-compose
|
创建安装目录
1 2 3 4 5
| sudo -i
mkdir -p /root/data/docker_data/npm
cd /root/data/docker_data/npm
|
dokcer 安装
1 2 3 4 5 6 7 8 9 10 11 12
| version: '3' services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: - '80:80' - '81:81' - '443:443' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt
|
1 2
| nginx -s stop docker-compose up -d
|
访问 Nginx Proxy Manager
更新 Nginx Proxy Manager
1 2 3 4 5 6 7 8 9 10 11
| cd /root/data/docker_data/npm
docker-compose down
cp -r /root/data/docker_data/npm /root/data/docker_data/npm.archive
docker-compose pull
docker-compose up -d
docker image prune
|
卸载 Nginx Proxy Manager
1 2 3 4 5
| cd /root/data/docker_data/npm
docker-compose down
rm -rf /root/data/docker_data/npm
|
设置负载均衡
1 2 3 4 5 6 7
| cd /root/data/docker_data/npm/data/nginx
mkdir custom
cd custom/
vi http.conf
|
1 2 3 4
| upstream backend { server backend1.example.com weight=5; server backend2.example.com backup; }
|
然后在WebUI中反代80端口,并在Advanced
中加入:
1 2 3
| location / { proxy_pass http://backend; }
|
反代 api.telegram.org
在Advanced
中加入:
1 2 3 4 5 6 7 8 9 10 11
| location ~* ^/bot { proxy_buffering off; proxy_pass https://api.telegram.org$request_uri; proxy_http_version 1.1; }
location /{ try_files /$uri $uri /index.html; }
|