Reverse proxy for NextCloud/Collabora

Discussion in 'ISPConfig 3 Priority Support' started by macguru, Mar 1, 2021.

  1. macguru

    macguru Member HowtoForge Supporter

    Hi,

    I have ISPConfig 3.1 on DMZ 192.168.1.xx, and I'm need to set reverse proxy for NextCloud/Collabora, hosted on another VM / DMZ IP = 192.168.1.yy, subdomain cloud.mydomain.com.
    cloud.mydomain.com resolves to external IP from outside, and to 192.168.1.xx in internal network, since router doesn't have hairpin NAT turned on.
    I found this recipe in old thread.

    Code:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    SSLProxyEngine On
    RequestHeader set Front-End-Https "On"
    ProxyPreserveHost On
    ProxyRequests Off
    ServerName cloud.mydomain.com
    ServerAlias cloud.mydomain.com
    ProxyPass / https://my.dmz.cloudvm.ip:443/
    ProxyPassReverse / https://my.dmz.cloudvm.ip:443/
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    
    Where my.dmz.vmcloud.ip is IP 192.168.1.yy of my NextCloud VM.

    Thanks in advance.
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    You could create a web with the nextcloud domain in ISPConfig and put this in the Apache directives:
    Code:
    ProxyPass / http://192.168.1.yy/
    ProxyPassReverse / http://192.168.1.yy/
     
  3. macguru

    macguru Member HowtoForge Supporter

    What is the best way to create cloud site subdomain for NextCloud/Collabora (e.g. cloud.mydomain.com, empty site with only ProxyPass in options), taking into account that I already have www.mydomain.com as main web site? I had an idea through "Subdomain for website", yet its seems this is not a good idea.
    Thanks in advance.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I would do what @Th0m suggested in #2.
     
  5. macguru

    macguru Member HowtoForge Supporter

    I have spare domain, so I created empty web site, Sites -> Web Domain -> Options -> Apache Directives -> code below + Enable PROXY protocol on. Unfortunately it doesn't work, I still see default Debian page from ISPConfig. 192.168.1.25 is an DMZ IP of my NextCloud server. ISPConfig VM is in same DMZ zone 192.168.1.xx.
    Or I should just add this to Apache conf ?

    Code:
    ProxyPass / http://192.168.1.25/
    ProxyPassReverse / http://192.168.1.25/
    ProxyPass / https://192.168.1.25/
    ProxyPassReverse / https://192.168.1.25/
    
     
  6. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Enabling PROXY protocol is not needed.

    By the way, you can add anything as website, not only a domain like example.com, but also sub.example.com, or nextcloud.example.com ;)
     
  7. macguru

    macguru Member HowtoForge Supporter

    Full snippet, still doesn't work, shows default Debian web site from ISPConfig. I'm missing something simple, yet can't figure out what.

    Code:
    ProxyPreserveHost On
    ProxyPass / http://192.168.1.25/
    ProxyPassReverse / http://192.168.1.25/
    ProxyPass / https://192.168.1.25/
    ProxyPassReverse / https://192.168.1.25/
    <Location />
    Order deny,allow
    Allow from all
    </Location>
    
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

  9. macguru

    macguru Member HowtoForge Supporter

    I got correct NextCloud page. I'll try to connect from outside of our network.
     
  10. macguru

    macguru Member HowtoForge Supporter

    OK, fixed, commands below, at least for HTTP is OK, HTTPS will try tomorrow.
    proxy_ajp is a key.
    Please include this in the ISPConfig manual, it is too stupid to spend so much time on so simple problems.

    Code:
    a2enmod proxy proxy_http proxy_ajp
    systemctl restart apache2
    
     
  11. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    The manual does not cover installing nextcloud, does it? mod_ajp "provides support for the Apache JServ Protocol version 1.3" - nothing in the manual (nor in any install I've worked with) uses Apache JServ, so this does not seem appropriate for the manual, unless a a generic note stating something like, "if sites you install require additional modules, you'll need to install and enable them" would prompt someone to look at the requirements of the software they're installing. Probably that would fit a post in Tips & Tricks, or even a short tutorial specific to nextcloud better.
     
    till likes this.
  12. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    This is not a ISPConfig but a Apache function.
     

Share This Page