# Apache vhost for https://mortgage.gventure.live
# Next.js (PM2) listens on 127.0.0.1:4350
# Server files: /var/www/html/gventure/mortgage  (app in .../web when full repo)
#
# Enable:
#   sudo a2enmod proxy proxy_http ssl rewrite headers
#   sudo cp deploy/mortgage.gventure.live.conf /etc/apache2/sites-available/
#   sudo a2ensite mortgage.gventure.live.conf
#   sudo systemctl reload apache2

<VirtualHost *:80>
  ServerName mortgage.gventure.live
  Redirect permanent / https://mortgage.gventure.live/
</VirtualHost>

<VirtualHost *:443>
  ServerName mortgage.gventure.live

  SSLEngine on
  # SSLCertificateFile      /etc/letsencrypt/live/mortgage.gventure.live/fullchain.pem
  # SSLCertificateKeyFile   /etc/letsencrypt/live/mortgage.gventure.live/privkey.pem

  ProxyPreserveHost On
  ProxyRequests Off
  RequestHeader set X-Forwarded-Proto "https"
  RequestHeader set X-Forwarded-Port "443"

  ProxyPass        / http://127.0.0.1:4350/
  ProxyPassReverse / http://127.0.0.1:4350/

  ErrorLog  ${APACHE_LOG_DIR}/mortgage.gventure.live-error.log
  CustomLog ${APACHE_LOG_DIR}/mortgage.gventure.live-access.log combined
</VirtualHost>
