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.
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…
@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.