I have an apache 2.4 web server that is a proxy front end for several other web apps inside my network (Confluence, Jira, phpmyadmin, etc.). I’d like to present nextcloud similarly, but seem to be having issues hashing out the proxy and rewrite configl
Apache config is set up currently to host each of the web apps via small “<location /app>” statement in a config file per web app in the conf.d directory. Below is the config I have for nextcloud, which is working to a limited extent. When visiting ‘https://web.domain.net/nextcloud’ I am shuffled over to ‘https://web.domain.net/login’. Expected result is for the browser url path become ‘/nextcloud/login’ and to see the full login page. The behavior indicates to me that I am reaching the nextcloud server correctly, but having issues with my rewrite. Pointing my browser at the expected url path (’/nextcloud/login’) gives me what I expect from the logon page (minus images (confirming that its almost working)).
RewriteRule ^/(.*) nextcloud/$1 [NC]
I’ve clearly got something wrong with my RewriteRule, and several iterations of attempting to correct this have resulted in no success. Anyone mind helping me locate the correct incantation?
Edit: blockquote of location config
in my setup I don’t use an …/apache2/conf.d/nextcloud.conf file. I go directly through the …/apache2/sites-available/nextcloud.conf.
On my apache reverse proxy machine I go simply like this (short form), to point to my internal network server:
...<blah entire SSL config stuff>...
ProxyPass / https://internal.domain.tld/ connectiontimeout=20 timeout=40
ProxyPassReverse / https://internal.domain.tld/
It works even without RewriteRule - I’m not sure if it’s working because I’m not using an additional /nextcloud path. And I’m not sure if it would work if I’ll try to add collabora stuff.
Maybe try it and add “/nextcloud/” to the ProxyPass and ProxyPassReverse entry.
What’s the purpose of using conf.d/nextcloud.conf anyway?
I did try ditching the conf.d config and did add the following directly to the default ssl virtual host:
ProxyPass /nextcloud https://nextcloud.domain.net/
ProxyPassReverse /nextcloud https://nextcloud.domain.net/
The browser however still drops the trailing /nextcloud so the url is transformed to web.domain.net/login instead of web.domain.net/nextcloud/login. My expectation was that the rewrite would address this.
Ok, I see.
ProxyPass / https://nextcloud.domain.net/nextcloud/
ProxyPassReverse / https://nextcloud.domain.net/nextcloud/
in your dedicated /etc/apache2/sites-available/nextcloud.conf
Maybe that works
Looks like my OVA install is not serving up under the /nextcloud path… Wonder how easy that is to change…