Nextcloud version (eg, 12.0.2): Nextcloud 16.0.4
Operating system and version (eg, Ubuntu 17.04): FreeBSD 11.2
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.1): 7.1.18
So to start, my Nextcloud instance is actually running perfectly fine. In an attempt to de-Google my life, I have been installing add-ons out the wazoo, and have managed to find a replacement for everything, except Google Docs and Gmail (replacements for both require extra setup outside of the Nextcloud web interface, and I haven’t had time until now.)
I finally have time to tackle trying to set up an email server. My nextcloud instance is running in a FreeBSD jail (similar to a chroot in other distros), and my eventual email server will run in another jail. So even through they are running on the same hardware, they have their own IP’s on my local network.
Since Nextcloud was the only website I served, I just pointed my domain to my home IP and forwarded ports 80/443 directly to Nextcloud; I can access my Nextcloud at example.com or www.example.com. I would like to set up the (web GUI for the) email server to be on a subdomain, ex: mail.example.com.
Am I able to do that within Nextcloud? Since the domain points to my home IP, and all HTTP/S traffic goes to nextcloud, would I have to set up some kind of redirect in the Nextcloud’s Apache server? I followed a FreeBSD-specific guide on how to install Nextcloud, so while I understand the very basics of how all the software interacts, I don’t know how to actually add this redirect.
no. since you have only one ip you want to setup a reverse proxy and a vhost.
Okay, can you let me know if i am doing this right? If I am reading the documentation correctly, then I need to add this to my
httpd.conf file (or an Includes file):
ProxyPass / http://email.server.ip
ProxyPassReverse / http://email.server.ip
[Block above, but with ‘https’
can’t paste the block again because the post would have
too many links for new users]
I tried adding it to the end of the config file for my nextcloud, which already has a
<VirtualHost *:80> and
<VirtualHost *:443> block for an HTTPS redirect. Adding these new block at the end broke the redirect, so I cannot access Nextcloud, nor can I access the proxied server. What am I doing wrong here?
Did you enable the needed modules?
I do not have
a2enmod installed, and I could not find it in the FreeBSD package manager, so there may not be anything available to me. The modules appear to be installed however, so I just un-commented the relevant ‘LoadModule’ lines in
And with that, it worked! I set up test.example.com to redirect to my second test website, and it works! Unfortunately, I now realize I have to abandon this method and use the sub-page method (ie, example.com/mail). My SSL certificate through my registrar is only valid for the ‘www’ subdomain. If I want to authenticate any others, I need to quintuple my yearly cost to a different package that supports other subdomains.
To do this, rather than creating two new blocks in my config file, I added the proxy lines into my existing blocks. So my pre-exisiting VHost blocks look like:
ProxyPass /mail http://[second server local ip]
ProxyPassReverse /mail http://[second server local ip]
ProxyPass /mail https://[second server local ip]
ProxyPassReverse /mail https://[second server local ip]
I am a bit wary of the
SSLProxyCheckPeerCN off and
SSLProxyCheckPeerName off lines, as they simply ignore the key mismatch (I loaded my domain certificate onto the test server, which obviously mismatches with the local IP that Nextcloud is using to connect.) Would it be better to self-sign a key on the second server, and load it into the Nextcloud server so the connection can be secured properly?
How to i do this using Nginx?