Hi everyone, I am looking for some help configuring Apache Web Server as a
reverse proxy.

A little background: I have a Debian 9 (stretch) server at my home, running
Nextcloud on Apache2. I have a static IP from my ISP, and a domain I own is
pointed to it. I have forwarded ports 80 and 443 on my router to the LAN IP
of my Debian server. Everything is configured and working, and I can access
my Nextcloud instance at https://mydomain.com

What I would like – and tell me if I'm barking up the wrong tree here – is
a secure way of accessing different services on my home network from the
internet. According to the material I have found, a reverse proxy is a good
way of doing this.

Put simply, I would like to be able to access my Nextcloud server at
https://nextcloud.mydomain.com and the ability to add other services (on
the same or different machines), such as https://email.mydomain.com
<http://email.mydomain.com/> or https://bittorrent.mydomain.com

Can someone help me with the configuration required to do this? Also, does
it defeat the purpose if the reverse proxy and the services I want to
access are on the same machine?

I have checked the documentation at
https://httpd.apache.org/docs/2.4/vhosts/examples.html and there is a brief
section on using virtual_host and mod_proxy together, but not enough detail
for me to create my own configs.

Here is my current Nextcloud configuration:


<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
    DocumentRoot /var/www/nextcloud
    CustomLog /var/log/apache2/nc-access.log combined
    ErrorLog  /var/log/apache2/nc-error.log
    SSLEngine on
    #SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateFile /home/john/ssl/certificate.crt
    #SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    SSLCertificateKeyFile /home/john/ssl/private.key
    <IfModule mod_rewrite.c>
      RewriteEngine On
      #RewriteBase /
      RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
      RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
    </IfModule>
  </VirtualHost>
  <Directory /var/www/nextcloud/>
    Options +FollowSymlinks
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
    LimitRequestBody 0
    SSLRenegBufferSize 10486000
  </Directory>
</IfModule>


Any help is much appreciated.

~John

Reply via email to