I have successfully set up Nextcloud on an Ubuntu 20.04 headless server. My intention is to have nextcloud listen on (say) 8433 and 8080 and respond to traffic from cloud.domain.tld while apache listens for ordinary web-traffic from domain.tld on 80 and 443. I know how to change nextcloudâs ports and have access to (i.e. can change) the DNS records on the domain. Iâm sure itâs simple but if anyone could point me to a step-by-step tutorial on how to go about this Iâd be very grateful.
Currently, nextcloud trusts both domain.tld and cloud.domain.tld.
The problem that I have that Google seems to yeild not too little but far too much information: even a suggestion as to a Google search string to narrow it down would be gratefully accepted.
You can use the ports 80 (redirect to 443) and 443 for your webserver and your nextcloud. Then the urls looks better and people in restricted areas (company lans) have got less (useless) problems. Set virtual name based hosts in apache2 .âcertbotâ can help you.
In this tuturial you setup an nextcloud virtual webserver only on port 80 and âcertbotâ generates Lets Encrypt Certificats and redirection from 80 to 443. You can use as much as you want subdomains (and domain.tld / www.domain.tld) with ports 80, 443, Lets Encrypt. You only must map (A-record, for domain, CNAME for subdomain) to the same ip-address.
Just to make it clear, Iâm not asking how to install nextcloud: Iâve already done that using snap and got it working just fine. I need to know how to configure Apache to sent subdomain traffic to nextcloud and domain traffic to webroot. Preferably in words of one syllable!
Ok, if Iâm understanding your situation, you have a non-snap Apache server already installed and serving some other web root, and what you need is a named virtual host added to your Apache server that will reverse proxy traffic to Nextcloud.
A named vhost allows Apache to deliver a different site based on the URL that was used, even though itâs ultimately coming to the same IP and server.
Yes, I have understand it similar. Because he uses Snap for Nextcloud (including apache2) and another apache2/webserver, he can not use the same sockets (IP:80) and (IP:443) because it is usede for apache2/webserver. But the different port is nothis problem. It is only setting the port.
Also, the Apache reverse proxy can serve the site on ports 80 and 443, even if itâs sending the connection to a backend server running on different ports.
No. The only Apache server is that installed by snap. Ubuntu server even has two boxes to tick on installation: install openssl and a menu of goodies to be installed by snap: I ticked nextcloud. It really is that simple, nothing else is installed. I just want to point the cloud subdomain to nextcloud and the ordinary traffic to webroot ON THE SAME Apache web server. Why is that so complicated?
Maybe because the nextcloud snap has itâs own apache server built-inâŚ
And since the snap is not writeable, I donât think that it is possible to use the apache server (that is provided by the nextcloud snap) for another web applicationâŚ
Because this is not the intended use case for snap. Snap is intended to compartmentalize the software and make it as simple for you as possible. A natural consequence of that is inflexibility.
Bottom line is to do what youâre asking, you would be best served by either
Installing a normal Apache instance via apt, having it reverse proxy the Nextcloud instance and serve your other site, or
Ditching snap altogether and using a normal Apache installation for both.
I would say neither option is particularly difficult, and #1 would probably suit you just fine. You wouldnât have to start over or anything. Hereâs how that would go if you want to try it.
First youâll need to change the port numbers for the snap Apache. I would change 80 and 443 to 8080 and 8443 respectively.
Then you will need to install Apache via apt and enable some mods.
You can use the default site if you like for your web root. Then youâll add a vhost config under /etc/apache2/sites-available with something like this:
Adjust as needed to fit your setup. At a minimum youâll need to change your ServerName to the subdomain you want it to use.
@KarlF12. I really canât thank you enough for this clear and lucid explanation. I did find your excellent post that you referred me to concerning Docker and Debian but had not realised how much of it would also work for Snap and Ubuntu so I had disregarded it. Apologies. Itâs going to take me a little while to work my way through all of this and I may come back with further queries but thank you for giving me a good place to start.
OK, Iâve followed the instructions and now have a (different) Apache server set up with my website holding page working fine on http(s);//badbury.org.uk. All good.
However, cloud.badbury.org.uk (the nextcloud server) returns a 503 error (service not available).
Here is the approriate virtual host configuration file. What have I missed?
Now, youâve downloaded the Nextcloud VM and youâve installed VMware Player. The VM comes as a â.OVA fileâ. To mount it, simply right click on the file and select âopen with VMware Playerâ.
What is this âright clickâ of which you speak? On a headless server? I think not.