在frps服务器上重建gitea服务器。数据库连到centos1上的mysql。

This commit is contained in:
Dennis Mo
2021-10-31 17:11:36 +08:00
parent 97d8ffa02d
commit 7d23a4c38f
10 changed files with 227 additions and 23 deletions

View File

@@ -18,7 +18,7 @@ https://gitea.io/en-us/
2. 安装docker-compose参考 <a href="https://www.4spaces.org/centos-install-docker-compose/" target="_blank">CENTOS安装Docker Compose</a>
3. 完成NginxAndLetsencrypt的部署
3. 完成NginxAndLetsencrypt的部署或acme参看acme项目的实例研究1
参见相关说明。包含把sample.conf改名为gitea.conf或其他名字
@@ -28,14 +28,19 @@ https://gitea.io/en-us/
6. 执行该sh脚本。注意可以通过tail -2 /etc/passwd和tail -2 /etc/group 查看新注册用户的uid和gid。如和docker-compose.yml中的不符合则应修改yml文件。
7. 执行 docker inspect nginxdocker_nginx_1 来确定nginx所在网络名称
7. 执行docker ps来查看当前的docker实例找到其中的nginx实例
......
84e4e7a719e8 nginx:latest "/bin/sh -c 'while :…" 17 months ago Up 5 weeks 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp **<u>nginx_nginx_1</u>**
8. 执行 docker inspect nginx_nginx_1来确定nginx所在网络名称
```
"Networks": {
"nginxdocker_default": {
"nginx_firstnet": {
```
8. 执行 docker network inspect nginxdocker_default 来确定一些网络信息:
9. 执行 docker network inspect nginx_firstnet 来确定一些网络信息:
```
"IPAM": {
@@ -43,24 +48,64 @@ https://gitea.io/en-us/
"Options": null,
"Config": [
{
"Subnet": "192.168.16.0/20",
"Gateway": "192.168.16.1"
"Subnet": "172.20.0.0/16"
}
]
},
......
"Containers": {
"84e4e7a719e8a904255ebcb522ce73ff8d0f2340a42d12969cead432ecdf4b77": {
"Name": "nginx_nginx_1",
"EndpointID": "f7a35255526ed39931e018ad27c2bcc448840f77f4de9666baa4416c396c03a7",
"MacAddress": "02:42:ac:14:00:02",
"IPv4Address": "172.20.0.2/16",
"IPv6Address": ""
},
"e390b8cbe5075efed7fb834acd74fe7ae84cc685249362b4802abb1e626fc909": {
"Name": "frps_server_1",
"EndpointID": "04f759a5e894e9286720946763b123f805c76d869697113e83f53e516ed75c4b",
"MacAddress": "02:42:ac:14:00:03",
"IPv4Address": "172.20.0.3/16",
"IPv6Address": ""
}
},
```
9. 根据上述两点网络相关的信息修改gitea的docker-compose文件中的对应部分并指定固定IP。
可以看到现有的网段和网络中已有实例的IP。我们可以据此规划gitea实例的IP。
9. 将需要nginx代理的应用设置的固定IP填入之前的gitea.conf
10. 根据上述两点网络相关的信息修改gitea的docker-compose文件中的对应部分并指定固定IP
11. 重启nginx的docker容器
11. 将需要nginx代理的应用设置的固定IP填入之前的gitea.conf
12. 启动gitea的docker-compose
12. 重启nginx的docker容器。
13. ```
docker-compose up -d
```
问题发现重启失败。查看nginx的日志
- 首先是错误unknown directive "server"
[root@ngork logs]# tail -20 error.log
2021/10/29 14:01:25 [emerg] 7#7: unknown directive "?server" in /etc/nginx/conf.d/gitwoyue.conf:1
在开发环境(windows)编码保存为简体中文936解决。原为utf-8。其实这很奇怪与一般的认知是相反的。
- 然后是open() "/etc/letsencrypt/options-ssl-nginx.conf" failed (2: No such file or directory) in /etc/nginx/conf.d/gitwoyue.conf:22
注释掉即可。
13. 启动gitea的docker-compose
`docker-compose up -d`
14. 访问网站。初始化
例如git.woyue.org。
这里注意参考用到的compose文件确认用户名是否需要修改默认git
另外需要创建一个空的数据库。默认名是gitea。
## 使用说明
- 配置文件在:/srv/gitea/gitea/gitea/conf下的app.ini
@@ -71,7 +116,8 @@ https://gitea.io/en-us/
## 测试环境
* CentOS Linux release 7.3.1611 (Core)
```
```
```