Create Separate DB for Subdomain(Vhost)

Discussion in 'ISPConfig 3 Priority Support' started by yupthatguy, Oct 4, 2021.

  1. yupthatguy

    yupthatguy Member

    In any case, back to the original problem.

    I have tested sevral variations of the reverse-proxy directives for gitea, all apache modules enabled, not matter which variation I try error log is now giving me the same error

    Code:
    [Tue Oct 05 18:15:10.821567 2021] [proxy:debug] [pid 14463] proxy_util.c(2032): AH00931: initialized single connection worker in child 14463 for (localhost)
    [Tue Oct 05 18:15:10.815536 2021] [proxy:debug] [pid 14462] proxy_util.c(1924): AH00925: initializing worker http://localhost:3000/ shared
    [Tue Oct 05 18:15:10.821697 2021] [proxy:debug] [pid 14462] proxy_util.c(1981): AH00927: initializing worker http://localhost:3000/ local
    [Tue Oct 05 18:15:10.821741 2021] [proxy:debug] [pid 14459] proxy_util.c(2032): AH00931: initialized single connection worker in child 14459 for (localhost)
    [Tue Oct 05 18:15:10.821946 2021] [proxy:debug] [pid 14460] proxy_util.c(2032): AH00931: initialized single connection worker in child 14460 for (localhost)
    [Tue Oct 05 18:15:10.822036 2021] [proxy:debug] [pid 14462] proxy_util.c(2032): AH00931: initialized single connection worker in child 14462 for (localhost)
    [Tue Oct 05 18:15:15.840376 2021] [proxy:debug] [pid 14618] proxy_util.c(1924): AH00925: initializing worker http://localhost:3000/ shared
    [Tue Oct 05 18:15:15.840403 2021] [proxy:debug] [pid 14618] proxy_util.c(1981): AH00927: initializing worker http://localhost:3000/ local
    [Tue Oct 05 18:15:15.840439 2021] [proxy:debug] [pid 14618] proxy_util.c(2032): AH00931: initialized single connection worker in child 14618 for (localhost)
    
    current directives:
    Code:
       ProxyPreserveHost On
        ProxyRequests off
        AllowEncodedSlashes NoDecode
        ProxyPass / http://localhost:3000/ nocanon
        ProxyPassReverse / http://localhost:3000/
    There is now redirect to gitea, just the index page that I added
     
  2. yupthatguy

    yupthatguy Member

    actually just read post #19.. I will take that approach
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    I don't think that this is an error. It's a debug message that shows you that it was successfully initialized.
     
  4. yupthatguy

    yupthatguy Member

    I just figured out something useful...

    DON'T use a domain alias if you are trying to set-up a reverse proxy.

    I changed my approach and set up a website at git.example.com
    Then I set-up a domain alias at tester1.git.example.com

    Each time I tried the recommended gitea apache directives... I got the same "initializing" debug messages above, but also a 503 error DNS lookup failure.

    So, I went to prod server and tried the same approach obviously not needing an alias domain...
    first attempt & the gitea install page appeared..

    so I went back to test server and removed the domain alias... sure enough, the gitea install page appeared.

    Any method to get that domain alias to stop causing problems? I am forgetful and I will at some point, not notice https: vs. http: in my browser.
     
  5. yupthatguy

    yupthatguy Member

    frustratingly... after I complete the form and submit test/prod the DNS issues continue...

    After clicking install on test server, it simply reverts back to default index.html page...
    -zero- debug/error/warnings in the apache log, nothing in the gitea log

    Meanwhile on prod server... I get 503 error and this in the apache log
    Code:
     [proxy:error] [pid 7083] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
    [Tue Oct 05 22:34:13.293953 2021] [proxy_http:error] [pid 7083] [client 116.198.192.46:38558] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
    
    I think the difference is ssl vs. no ssl
     
  6. yupthatguy

    yupthatguy Member

    Hey there...

    can you confirm that my approach for making git.example.com is correct? My problems seem DNS related.

    On this attempt:

    1.) I created a DNS record for "git" in the DNS Zone for example.com (TLD for server)
    2.) I created an entirely DNS DNS Zone for git.example.com
    3.) I created a new website for git.example.com

    I am using this apache2 directivce for the proxy that was recommended by the gitea folks:
    Code:
     ProxyPreserveHost On
        ProxyRequests off
        AllowEncodedSlashes NoDecode
        SSLProxyEngine on
        ProxyPass / http://127.0.0.1:3000/ nocanon
        ProxyPassReverse / http://127.0.0.1:3000/

    I get this in my error log:

    Code:
    [Fri Oct 08 15:16:52.232056 2021] [proxy:error] [pid 12927] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
    [Fri Oct 08 15:16:52.232079 2021] [proxy_http:error] [pid 12927] [client 192.168.0.10:39186] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232086 2021] [proxy:debug] [pid 12927] proxy_util.c(2331): AH00943: HTTP: has released connection for (127.0.0.1)
    [Fri Oct 08 15:16:52.232125 2021] [proxy:debug] [pid 12927] mod_proxy.c(1249): [client 192.168.0.10:39186] AH01143: Running scheme http handler (attempt 0), referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232132 2021] [proxy_fcgi:debug] [pid 12927] mod_proxy_fcgi.c(1021): [client 192.168.0.10:39186] AH01076: url: http://127.0.0.1:3000/error/503.html proxyname: (null) proxyport: 0, referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232137 2021] [proxy_fcgi:debug] [pid 12927] mod_proxy_fcgi.c(1024): [client 192.168.0.10:39186] AH01077: declining URL http://127.0.0.1:3000/error/503.html, referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232157 2021] [proxy:debug] [pid 12927] proxy_util.c(2316): AH00942: HTTP: has acquired connection for (127.0.0.1)
    [Fri Oct 08 15:16:52.232163 2021] [proxy:debug] [pid 12927] proxy_util.c(2369): [client 192.168.0.10:39186] AH00944: connecting http://127.0.0.1:3000/error/503.html to 127.0.0.1:3000, referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232168 2021] [proxy:debug] [pid 12927] proxy_util.c(2578): [client 192.168.0.10:39186] AH00947: connected /error/503.html to 127.0.0.1:3000, referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232216 2021] [proxy:error] [pid 12927] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
    [Fri Oct 08 15:16:52.232224 2021] [proxy_http:error] [pid 12927] [client 192.168.0.10:39186] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: http://git.example.com/
    [Fri Oct 08 15:16:52.232229 2021] [proxy:debug] [pid 12927] proxy_util.c(2331): AH00943: HTTP: has released connection for (127.0.0.1)
     
  7. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    My understanding is you can not do both 1) and 2). Do only one of them.
     
  8. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Sounds like there's nothing listening on port 3000 for your proxied connection to go to - you need to start up gitea or something?
     
  9. yupthatguy

    yupthatguy Member

    @Jesse Norell thanks for the tip.. apparently one to many server rollbacks and install attempts.. I eventually missed setting up the service. In any case. I can now successfully install gitea and reach the app's install page consistently, but I am still getting 503 error every time I click install on the web gui.

    Code:
    [Sat Oct 09 10:21:10.663623 2021] [authz_core:debug] [pid 12367] mod_authz_core.c(846): [client 192.168.0.10:56748] AH01628: authorization result: granted (no directives), referer: http://tester1.git.example.com/tester1.git.example.com/user/login
    [Sat Oct 09 10:21:10.663968 2021] [proxy:debug] [pid 12367] mod_proxy.c(1249): [client 192.168.0.10:56748] AH01143: Running scheme http handler (attempt 0), referer: http://tester1.git.example.com/tester1.git.example.com/user/login
    [Sat Oct 09 10:21:10.664000 2021] [proxy_fcgi:debug] [pid 12367] mod_proxy_fcgi.c(1021): [client 192.168.0.10:56748] AH01076: url: http://127.0.0.1:3000/favicon.ico proxyname: (null) proxyport: 0, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
    [Sat Oct 09 10:21:10.664008 2021] [proxy_fcgi:debug] [pid 12367] mod_proxy_fcgi.c(1024): [client 192.168.0.10:56748] AH01077: declining URL http://127.0.0.1:3000/favicon.ico, referer: http://tester1.git.example.com/tester1.git.example.com/user/login
    [Sat Oct 09 10:21:10.664017 2021] [proxy:debug] [pid 12367] proxy_util.c(2330): AH00942: HTTP: has acquired connection for (127.0.0.1)
    [Sat Oct 09 10:21:10.664027 2021] [proxy:debug] [pid 12367] proxy_util.c(2383): [client 192.168.0.10:56748] 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 10:21:10.664057 2021] [proxy:debug] [pid 12367] proxy_util.c(2592): [client 192.168.0.10:56748] 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 10:21:10.731686 2021] [proxy:debug] [pid 12367] proxy_util.c(2345): AH00943: http: has released connection for (127.0.0.1)
    These are all my steps to install:
    Code:
    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://servername/install
    
    When I complete the web gui... I have tried with the domain alias "tester1." and without the domain alias and get the same result..

    What am I missing?
     
  10. yupthatguy

    yupthatguy Member

    Last edited: Oct 9, 2021
  11. yupthatguy

    yupthatguy Member

    I solved this problem by disabling (unchecking) the Enable Proxy box on ISPConfig.. and then using these apache2 directives:

    Code:
       ProxyPreserveHost On
       ProxyRequests off
       AllowEncodedSlashes NoDecode
       ProxyPass / http://localhost:3000/ nocanon
       ProxyPassReverse / http://localhost:3000/
    Now Gitea is happy...
     
    till likes this.

Share This Page