title: Problems Redirecting Apache 443 port to Nginx port 1234 for co-hosting Nextcloud and Gitlab
body: <p>I have a similar problem as mentioned in <a href="https://stackoverflow.com/questions/8541182/apache-redirect-to-another-port">Apache redirect to another port</a> but the answer does not work for me.</p>
  <p>I have Apache set up on an Debian VM, with an instance of Nextcloud.
  I setup a vhost for <strong>cloud.mydomain.com</strong> on port 443 and it works fine.</p>
  <p>Also, I installed Gitlab on the same VM, and the external url is <strong><a href="https://debianvm.local:1234" rel="nofollow noreferrer">https://debianvm.local:1234</a></strong></p>
  <p>How can I redirect <strong><a href="https://gitlab.mydomain.com:443" rel="nofollow noreferrer">https://gitlab.mydomain.com:443</a></strong> to <strong><a href="https://debianvm.local:1234" rel="nofollow noreferrer">https://debianvm.local:1234</a></strong> ??</p>
  <p>I have tried</p>
  <pre><code>&lt;VirtualHost *:443&gt;
    ServerName gitlab.mydomain.com
    ServerAlias gitlab.mydomain.com
    ProxyPass / https://debianvm:8508/
  
  SSLEngine on
  SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
  &lt;/VirtualHost&gt;
  </code></pre>
  <p>I was hoping to later be able to call <code>certbot -d gitlab.mydomain.com</code> and change the certificate...</p>
  <p>I also tried putting exactly the same file for <code>*:80</code> (without SSLEngine lines) and then call  <strong>certbot</strong> but without success.</p>
  <p>I also tried directly putting <strong><a href="https://gitlab.mydomain.com" rel="nofollow noreferrer">https://gitlab.mydomain.com</a></strong> in the gitlab configuration, in vain.</p>
  <p>Any ideas?</p>
  <p>Thanks.</p>
  <p>On the DNS side, I set up 2 DNS redirections type A: one for <strong>cloud.mydomain.com</strong> and one for <strong>gitlab.mydomain.com</strong>, but they are pointing to the same IP.</p>
  <p>On the port forwarding side, the NAS with the host IP is forwarding 80 and 443 to 80 and 443 of the <strong>debianvm.local</strong></p>