-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from Integral-Tech/add-nginx-certbot
Add nginx certbot examples
- Loading branch information
Showing
6 changed files
with
241 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
docker-compose-examples/NapCat/with-nginx-certbot/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
version: "3.8" | ||
|
||
volumes: | ||
postgresql: | ||
q2tg: | ||
cache: | ||
napcat-data: | ||
napcat-config: | ||
|
||
services: | ||
postgres: | ||
image: postgres:14-alpine | ||
restart: unless-stopped | ||
environment: | ||
POSTGRES_DB: db_name | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: password | ||
volumes: | ||
- postgresql:/var/lib/postgresql/data | ||
|
||
napcat: | ||
image: mlikiowa/napcat-docker:latest | ||
environment: | ||
- ACCOUNT=要登录的 QQ 号 | ||
- WS_ENABLE=true | ||
- NAPCAT_GID=1000 | ||
- NAPCAT_UID=1000 | ||
ports: | ||
- 6099:6099 | ||
mac_address: 02:42:12:34:56:78 # 请修改为一个固定的 MAC 地址,但是不要和其他容器或你的主机重复 | ||
restart: unless-stopped | ||
volumes: | ||
- napcat-data:/app/.config/QQ | ||
- napcat-config:/app/napcat/config | ||
- cache:/app/.config/QQ/NapCat/temp | ||
|
||
q2tg: | ||
image: ghcr.io/clansty/q2tg:sleepyfox | ||
restart: unless-stopped | ||
depends_on: | ||
- postgres | ||
- napcat | ||
ports: | ||
# 如果要使用 RICH_HEADER 需要将端口发布到公网 | ||
- 8080:8080 | ||
volumes: | ||
- q2tg:/app/data | ||
- cache:/app/.config/QQ/NapCat/temp | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
environment: | ||
- TG_API_ID= | ||
- TG_API_HASH= | ||
- TG_BOT_TOKEN= | ||
- DATABASE_URL=postgres://user:password@postgres/db_name | ||
- NAPCAT_WS_URL=ws://napcat:3001 | ||
- TG_CONNECTION=tcp # 连接 Telegram 的方式,也可以改成 websocket | ||
# 如果你需要使用 /flags set RICH_HEADER 来显示头像,或者正确显示合并转发的消息记录,则需将 q2tg 8080 端口发布到公网,可以使用 cloudflare tunnel | ||
# 请尽量配置这个服务 | ||
- WEB_ENDPOINT= # https://yourichheader.com 填写你发布到公网的域名 | ||
#- CRV_VIEWER_APP= | ||
# DEPRECATED: 请使用 WEB_ENDPOINT | ||
#- CRV_API= | ||
#- CRV_KEY= | ||
# 要关闭文件上传提示,请取消注释以下变量 https://github.com/clansty/Q2TG/issues/153 | ||
#- DISABLE_FILE_UPLOAD_TIP=1 | ||
# 如果需要通过代理联网,那么设置下面两个变量 | ||
#- PROXY_IP= | ||
#- PROXY_PORT= | ||
# 代理联网认证,有需要请修改下面两个变量 | ||
#- PROXY_USERNAME= | ||
#- PROXY_PASSWORD= | ||
|
||
nginx: | ||
image: nginx:alpine | ||
restart: unless-stopped | ||
ports: | ||
- 80:80 | ||
- 443:443 | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
- ./certbot/www:/var/www/certbot:ro | ||
- ./certbot/cert:/etc/letsencrypt:ro | ||
depends_on: | ||
- q2tg | ||
|
||
certbot: | ||
image: certbot/certbot:latest | ||
volumes: | ||
- ./certbot/www:/var/www/certbot | ||
- ./certbot/cert:/etc/letsencrypt | ||
depends_on: | ||
- nginx | ||
command: certonly --webroot -w /var/www/certbot --force-renewal --email 你的邮箱 -d 你的域名 --agree-tos |
32 changes: 32 additions & 0 deletions
32
docker-compose-examples/NapCat/with-nginx-certbot/nginx.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
worker_processes auto; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
location /.well-known/acme-challenge/ { | ||
root /var/www/certbot; | ||
} | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
# server { | ||
# listen 443 ssl; | ||
# listen [::]:443 ssl; | ||
# server_name 你的域名; | ||
# ssl_certificate /etc/letsencrypt/live/你的域名/fullchain.pem; | ||
# ssl_certificate_key /etc/letsencrypt/live/你的域名/privkey.pem; | ||
|
||
# location / { | ||
# proxy_pass http://q2tg:8080; | ||
# } | ||
# } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
docker-compose-examples/icqq/with-nginx-certbot/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
version: "3.8" | ||
|
||
volumes: | ||
postgresql: | ||
q2tg: | ||
cache: | ||
|
||
services: | ||
# 如果有现成的 Postgresql 实例,可以删除这一小节 | ||
postgres: | ||
image: postgres:14-alpine | ||
restart: unless-stopped | ||
environment: | ||
POSTGRES_DB: db_name | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: password | ||
volumes: | ||
- postgresql:/var/lib/postgresql/data | ||
|
||
sign: | ||
image: ghcr.io/clansty/qsign | ||
restart: unless-stopped | ||
|
||
q2tg: | ||
image: ghcr.io/clansty/q2tg:sleepyfox | ||
restart: unless-stopped | ||
depends_on: | ||
- postgres | ||
- sign | ||
ports: | ||
# 如果要使用 RICH_HEADER 需要将端口发布到公网 | ||
- 8080:8080 | ||
volumes: | ||
- q2tg:/app/data | ||
# 下面这行是固定的,和你用不用 NapCat 没关系,不要动 | ||
- cache:/app/.config/QQ/NapCat/temp | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
environment: | ||
- TG_API_ID= | ||
- TG_API_HASH= | ||
- TG_BOT_TOKEN= | ||
- DATABASE_URL=postgres://user:password@postgres/db_name | ||
- SIGN_API=http://sign:4848/sign?key=114514 | ||
- SIGN_VER=9.0.56 # 与上方 sign 容器的配置同步 | ||
- TG_CONNECTION=tcp # 连接 Telegram 的方式,也可以改成 websocket | ||
# 如果你需要使用 /flags set RICH_HEADER 来显示头像,或者正确显示合并转发的消息记录,则需将 q2tg 8080 端口发布到公网,可以使用 cloudflare tunnel | ||
# 请尽量配置这个服务 | ||
- WEB_ENDPOINT= # https://yourichheader.com 填写你发布到公网的域名 | ||
#- CRV_VIEWER_APP= | ||
# DEPRECATED: 请使用 WEB_ENDPOINT | ||
#- CRV_API= | ||
#- CRV_KEY= | ||
# 要关闭文件上传提示,请取消注释以下变量 https://github.com/clansty/Q2TG/issues/153 | ||
#- DISABLE_FILE_UPLOAD_TIP=1 | ||
# 如果需要通过代理联网,那么设置下面两个变量 | ||
#- PROXY_IP= | ||
#- PROXY_PORT= | ||
# 代理联网认证,有需要请修改下面两个变量 | ||
#- PROXY_USERNAME= | ||
#- PROXY_PASSWORD= | ||
|
||
nginx: | ||
image: nginx:alpine | ||
restart: unless-stopped | ||
ports: | ||
- 80:80 | ||
- 443:443 | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
- ./certbot/www:/var/www/certbot:ro | ||
- ./certbot/cert:/etc/letsencrypt:ro | ||
depends_on: | ||
- q2tg | ||
|
||
certbot: | ||
image: certbot/certbot:latest | ||
volumes: | ||
- ./certbot/www:/var/www/certbot | ||
- ./certbot/cert:/etc/letsencrypt | ||
depends_on: | ||
- nginx | ||
command: certonly --webroot -w /var/www/certbot --force-renewal --email 你的邮箱 -d 你的域名 --agree-tos |
32 changes: 32 additions & 0 deletions
32
docker-compose-examples/icqq/with-nginx-certbot/nginx.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
worker_processes auto; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
|
||
location /.well-known/acme-challenge/ { | ||
root /var/www/certbot; | ||
} | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
# server { | ||
# listen 443 ssl; | ||
# listen [::]:443 ssl; | ||
# server_name 你的域名; | ||
# ssl_certificate /etc/letsencrypt/live/你的域名/fullchain.pem; | ||
# ssl_certificate_key /etc/letsencrypt/live/你的域名/privkey.pem; | ||
|
||
# location / { | ||
# proxy_pass http://q2tg:8080; | ||
# } | ||
# } | ||
} |