initial commit

This commit is contained in:
gin
2026-06-08 15:00:35 +08:00
commit d96692d19b
7 changed files with 109 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.env
+27
View File
@@ -0,0 +1,27 @@
# 服务部署
## nginx
:warning: 修改默认配置 `nginx/conf.d/default.conf` 文件,以满足自己的要求
如果需要配置 `https` 则把证书放在 `nginx/ssl` 目录下
启动服务
```bash
docker compose up -d
```
## gitea
复制环境变量示例文件并修改环境变量
```bash
cp .env.example .env
```
启动服务
```bash
docker compose up -d
```
+3
View File
@@ -0,0 +1,3 @@
GITEA_DATABASE_PASSWD=gitea
MYSQL_ROOT_PASSWORD=root
MYSQL_PASSWORD=gitea
+41
View File
@@ -0,0 +1,41 @@
networks:
gitea:
external: false
services:
server:
image: docker.gitea.com/gitea:1.26.2
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=db:3306
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=${GITEA_DATABASE_PASSWD:-gitea}
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
depends_on:
- db
db:
image: docker.io/library/mysql:8
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-gitea}
- MYSQL_USER=gitea
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-gitea}
- MYSQL_DATABASE=gitea
networks:
- gitea
volumes:
- ./mysql:/var/lib/mysql
+23
View File
@@ -0,0 +1,23 @@
server {
listen 80;
server_name <domain_name>; # 替换为自己的域名
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name <domain_name>; # 替换为自己的域名
ssl_certificate /etc/nginx/ssl/<ssl_file>.crt; # ssl 证书
ssl_certificate_key /etc/nginx/ssl/<ssl_file>.key; # ssl 证书
client_max_body_size 50m;
location / {
proxy_pass <server_url>; # 代理地址,可访问的项目地址
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;
}
}
+14
View File
@@ -0,0 +1,14 @@
services:
nginx:
image: nginx:latest
container_name: main-nginx
ports:
- "80:80"
- "443:443"
volumes:
# 挂载一个包含额外server配置的目录
- ./conf.d:/etc/nginx/conf.d
# 挂载日志目录
- ./logs:/var/log/nginx
# 挂载证书
- ./ssl:/etc/nginx/ssl:ro
View File