OverviewFilesCommitsIssuesDocsReleasesPeers

pear-git / docs / APACHE_CONFIG.txt

126 lines · txt ref:
# Apache Configuration for 7rnx.net
# Add this to: /etc/apache2/sites-available/7rnx.net-le-ssl.conf

# Instructions:
# 1. SSH/mosh to 7rnx.net
# 2. sudo nano /etc/apache2/sites-available/7rnx.net-le-ssl.conf
# 3. Find the existing <VirtualHost *:443> section
# 4. Add the sections below BEFORE the closing </VirtualHost>
# 5. Save and exit (Ctrl+O, Enter, Ctrl+X)
# 6. Test: sudo apache2ctl configtest
# 7. Reload: sudo systemctl reload apache2

# ============================================================================
# ADD THESE SECTIONS TO YOUR EXISTING <VirtualHost *:443>
# ============================================================================

  # Pear-git forge on /git prefix
  # Proxies to tabertron.local via hyperident-gateway VPN
  <Location /git>
    # Proxy to tabertron via VPN
    ProxyPass http://10.22.0.2:3003
    ProxyPassReverse http://10.22.0.2:3003

    # Preserve Host header
    ProxyPreserveHost On

    # Git protocol settings
    SetEnv GIT_PROJECT_ROOT /git
    SetEnv GIT_HTTP_EXPORT_ALL

    # Increase timeout for large clones
    ProxyTimeout 600

    # CORS headers (if needed for web UI)
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
  </Location>

  # WebSocket support for real-time updates
  <Location /git/ws>
    ProxyPass ws://10.22.0.2:3003/ws
    ProxyPassReverse ws://10.22.0.2:3003/ws
  </Location>

# ============================================================================
# COMPLETE EXAMPLE (if creating from scratch)
# ============================================================================

<VirtualHost *:443>
  ServerName 7rnx.net

  # Existing SSL config
  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/live/7rnx.net/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/7rnx.net/privkey.pem

  # Existing DocumentRoot
  DocumentRoot /var/www/7rnx.net

  # NEW: Pear-git forge on /git prefix
  <Location /git>
    ProxyPass http://10.22.0.2:3003
    ProxyPassReverse http://10.22.0.2:3003
    ProxyPreserveHost On
    SetEnv GIT_PROJECT_ROOT /git
    SetEnv GIT_HTTP_EXPORT_ALL
    ProxyTimeout 600
  </Location>

  # NEW: WebSocket support
  <Location /git/ws>
    ProxyPass ws://10.22.0.2:3003/ws
    ProxyPassReverse ws://10.22.0.2:3003/ws
  </Location>

  # Existing logging
  ErrorLog ${APACHE_LOG_DIR}/7rnx.net-error.log
  CustomLog ${APACHE_LOG_DIR}/7rnx.net-access.log combined
</VirtualHost>

# ============================================================================
# VERIFICATION STEPS
# ============================================================================

# After editing:
sudo apache2ctl configtest
# Should output: Syntax OK

# Reload Apache:
sudo systemctl reload apache2

# Check status:
sudo systemctl status apache2

# Test from 7rnx.net:
curl http://10.22.0.2:3003/git/
# Should return HTML (pear-git web UI)

# Test from internet (after starting pear-git on tabertron):
curl https://7rnx.net/git/
# Should return HTML

# ============================================================================
# TROUBLESHOOTING
# ============================================================================

# If "Syntax OK" but not working:
# 1. Check VPN is up:
ping 10.22.0.1

# 2. Check can reach tabertron via VPN:
curl http://10.22.0.2:3003/git/

# 3. Check Apache error logs:
sudo tail -f /var/log/apache2/7rnx.net-error.log

# 4. Restart Apache (if reload didn't work):
sudo systemctl restart apache2

# If "Syntax Error":
# - Check all brackets match: <Location> ... </Location>
# - Check no typos in directives
# - Check ProxyPass URLs have correct format

# ============================================================================