Gitea W. Debian 10 (LAMP) ISPConfig 和反向代理

Gitea W. Debian 10 (LAMP) ISPConfig 和反向代理

我卡住了。使用以下步骤,我能够在系统上安装 Gitea,但在填写我的数据并单击“安装”后,我一直收到 503 错误。

以下是我的安装步骤:

1.) # apt -y install git bash-completion
2.) #git version
3.) #adduser \
   --system \
   --shell /bin/bash \
   --gecos 'Git Version Control' \
   --group \
   --disabled-password \
   --home /home/git \
   git
4.) Creat gitea db in ispc GUI
5.) curl -s  https://api.github.com/repos/go-gitea/gitea/releases/latest |grep browser_download_url  |  cut -d '"' -f 4  | grep '\linux-amd64$' | wget -i -
6.) chmod +x gitea-*-linux-amd64
7.) cp gitea-*-linux-amd64 /usr/local/bin/gitea
8.) gitea --version
9.) mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}
10.) chown git:git /var/lib/gitea/{data,indexers,log}
11.) chmod 750 /var/lib/gitea/{data,indexers,log}
12.) chown root:git /etc/gitea
13.) chmod 770 /etc/gitea
14.) nano /etc/systemd/system/gitea.service
--add:
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
After=mysql.service

[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target

15.) #systemctl daemon-reload
16.) #systemctl enable --now gitea
17.) systemctl status gitea
18.) Add apacche directive in ISPC gui
  --add:
 ProxyPreserveHost On
    ProxyRequests off
    AllowEncodedSlashes NoDecode
    SSLProxyEngine on
    ProxyPass / http://127.0.0.1:3000/ nocanon
    ProxyPassReverse / http://127.0.0.1:3000/

19.) #systemctl restart apache2
20.) visit http://tester1.git.example.com/install (Note: "tester1" is a ISPConfig domain alias)

I enter dbuser, dbname, dbpwd, SSH Server Domain = tester1.git.example.com , Gitea Base URL = tester1.git.exmaple.com

gitea 登陆页面尝试短暂加载,但最终出现 503 错误,浏览器的地址栏中显示以下内容:

http://tester1.git.example.com/tester1.git.example.com/user/login

我的错误日志中有这个:

[Sat Oct 09 12:05:20.381832 2021] [proxy:debug] [pid 10029] proxy_util.c(2383): [client 192.168.0.10:35592] AH00944: connecting http://127.0.0.1:3000/favicon.ico to 127.0.0.1:3000, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.381952 2021] [proxy:debug] [pid 10029] proxy_util.c(2592): [client 192.168.0.10:35592] AH00947: connected /favicon.ico to 127.0.0.1:3000, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382110 2021] [proxy:error] [pid 10029] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
[Sat Oct 09 12:05:20.382132 2021] [proxy_http:error] [pid 10029] [client 192.168.0.10:35592] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382142 2021] [proxy:debug] [pid 10029] proxy_util.c(2345): AH00943: HTTP: has released connection for (127.0.0.1)
[Sat Oct 09 12:05:20.382211 2021] [proxy:debug] [pid 10029] mod_proxy.c(1249): [client 192.168.0.10:35592] AH01143: Running scheme http handler (attempt 0), referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382222 2021] [proxy_fcgi:debug] [pid 10029] mod_proxy_fcgi.c(1021): [client 192.168.0.10:35592] AH01076: url: http://127.0.0.1:3000/error/503.html proxyname: (null) proxyport: 0, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382231 2021] [proxy_fcgi:debug] [pid 10029] mod_proxy_fcgi.c(1024): [client 192.168.0.10:35592] AH01077: declining URL http://127.0.0.1:3000/error/503.html, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382240 2021] [proxy:debug] [pid 10029] proxy_util.c(2330): AH00942: HTTP: has acquired connection for (127.0.0.1)
[Sat Oct 09 12:05:20.382249 2021] [proxy:debug] [pid 10029] proxy_util.c(2383): [client 192.168.0.10:35592] AH00944: connecting http://127.0.0.1:3000/error/503.html to 127.0.0.1:3000, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382258 2021] [proxy:debug] [pid 10029] proxy_util.c(2592): [client 192.168.0.10:35592] AH00947: connected /error/503.html to 127.0.0.1:3000, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382356 2021] [proxy:error] [pid 10029] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
[Sat Oct 09 12:05:20.382369 2021] [proxy_http:error] [pid 10029] [client 192.168.0.10:35592] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
[Sat Oct 09 12:05:20.382377 2021] [proxy:debug] [pid 10029] proxy_util.c(2345): AH00943: HTTP: has released connection for (127.0.0.1)

有人知道我遗漏了什么吗?谢谢

答案1

我知道出了什么问题......

解决方案:在 ISPConfig gui 中,我进入域 -> 网站 -> <git.example.com> -> 选项,然后我未选中/禁用ISPconfig 的“启用代理”复选框...

并将 Apache2 指令更改为:

ProxyPreserveHost On
ProxyRequests off
AllowEncodedSlashes NoDecode
ProxyPass / http://localhost:3000/ nocanon
ProxyPassReverse / http://localhost:3000/ 

现在一切都正常运转。

相关内容