Hosting many domains
I have a lightly used server instance which originally was configured to run Nginx and serve several independent domains. The sites were currently static, but I was going to deploy apps based on Flask or Pyramid (using Python 3). I've taken those down for now to bring up Cloudron with email, which we now have working. (i only needed email for one domain.)
I would like to bring the previous sites back. They originally configured as "sites-enabled" under Ubuntu 16.04. So far as I can tell, Cloudron will only let me deploy one domain name. (At least, this is from looking at the LAMP and Surfer apps in the App Store.) I'm tempted to go modify an nginx.conf file somewhere, but it is not clear how to do this in a Cloudron-compatible way.
To complicate matters, a domain registrar audited my sites and urged me to use HTTPS, which led to registering the domains with Let's Encrypt. (For now, it's one common certificate for all of the domains.)
Is there a straight-forward way to host/restore my many domains, and also get HTTPS enabled for them?
timmmmyboy last edited by
You can have any number of domains, here is information on adding them https://cloudron.io/documentation/domains/. Once a domain is configured it becomes an optional location when installing an app. Let's Encrypt is setup automatically when you install an app in Cloudron.
Thanks, adding the domains turned out to be straight-forward.
Enabling a web service is getting me in trouble. I've tried both the LAMP and Surfer apps; if I simply use the registered domain, e.g., "foosite.tld" and I already have A, MX, and other records for that domain, then installation results in app status as "Error" (below domain name ion app icon of Your Apps). Hovering over "Error" shows "DNS record already exists", and clicking on it gives a pop-up:
Error for foosite.tld The DNS record for this location already exists. Manually remove the DNS record and then click on repair.
[Late update] I'm working through this part.... It seems the solution is use "www" as the subdomain and do something later with .htaccess, although this might not be completely necessary.
I now have the LAMP app running on subdomain "www" of "domain1.com". I've added my version of the redirect shown at the bottom of the "Apps" page in the Knowledge Base. That is, in ".htaccess", I have
redirect 301 / https://domain1.com/
I have added the second domain, "domain2.com". So far, I have not found a way to add content for it.
Peering though the web terminal, which drops me into "/app/data", I can go down to "public" and see the content I added for the first website. Is there a way to enable a second path for the second domain?
If I understand you correctly, you need to install another app for (www.)domain2.com, you can't use the same LAMP for multiple domains. The forward to my.domain1.com probably happens becase the DNS records point to the cloudron IP.
As @msbt suggests, currently two apps are required with one being simply an alias app. You can read more about this at https://cloudron.io/documentation/apps/#redirecting-www-domain
The upstream issue to solve this for good is https://git.cloudron.io/cloudron/box/issues/133
@msbt So if I understand correctly, although I have one virtual server, I will need a separate IP address for each domain name.
Just to recap, I had a multi-site nginx config handling several domain names on the same virtual server, with single IP address. The wrinkle that caused me/us to come to Cloudron was the pain of setting up a secure mail server; I was recommended here by another Cloudron user.
It has been suggested to me as a fallback that I restore the multi-site nginx config, and put the mail server that I need in a separate Cloudron (or on my friend's Cloudron). This sounds like I need:
A domain1.com IP1 A domain2.com IP1 ... A domainN.com IP1 A www.domain1.com IP1 A www.domain2.com IP1 ... A www.domainN.com IP1 A my.domain1.com IP2 A my.domain2.com IP2 MX domain1.com IP2 MX domain2.com IP2
Currently, I have 6 domains, mostly with independent content. Only one of these needs mail now, but I anticipate another needing it in a few months.
In fact, can Cloudron handle mail for multiple domain names on a single server?
@rockets no no, you can host all domains on a single ip address. You have to add the domains to your cloudron and when you set up the single websites, you need to point the A records for the domain and www.domain to the cloudron ip (or just set up wildcards). After that you're able to add apps like surfer or lamp where you can host the domains (and corresponding forwards - as @nebulon mentioned, at the moment you need one forwarder for each domain from or to the www.domain, depending on which version you prefer).
As for the mail issue: Cloudron can easily handle multiple domains, you just need to enable it in the control panel and adjust the MX, DKIM, SPF, DMARC and PTR records for each domain.
FYI, we have started working on the redirect feature and it will be part of 3.0. This will solve the common use-case of www redirects. See https://git.cloudron.io/cloudron/box/issues/133
@nebulon This is related somehow to Stripe? Link went to Stripe login page.
Oh I pasted the wrong link apparently, fixed it now.