External A record (Strapi) + YunoHost mail setup – best practice? / Domaine avec A record externe (Strapi) + mail via YunoHost : bonne pratique?

Discuss

Title: External A record (Strapi) + YunoHost mail setup – best practice?

Hello dear YunoHost community,

maybe you can help me with the following scenario:

I am running a VPS with YunoHost, currently hosting around ten domains including mail servers. Now I need to add another domain — but with a special setup:
The domain’s A record points to the IP address of an external Strapi cloud. So the entire website and CMS are not hosted on my YunoHost server.

However, I still want to run the following via YunoHost:

  • the mail server
  • as well as Let’s Encrypt certificates for mail services

This raises a few questions for me:

YunoHost usually expects A/AAAA records to point to the server in order to automatically issue certificates. In my case, the domain intentionally points to an external IP (Strapi), which already provides its own Let’s Encrypt certificate.

My current idea is:

  • set the MX record to mail.domain.tld (instead of domain.tld, as YunoHost typically suggests)
  • create a subdomain like mail.domain.tld pointing to my YunoHost server
  • generate a Let’s Encrypt certificate for this subdomain via YunoHost

My questions:

  • Does this setup make sense / is it considered best practice?
  • Do I need to explicitly create the subdomain (mail.domain.tld) in the YunoHost interface and request a separate certificate for it?
  • Will mail services (SMTP, IMAP, etc.) work properly if only the mail subdomain points to YunoHost?
  • Could this configuration have any impact on my existing domains and mail servers?
  • Are there any common pitfalls I should watch out for (SPF, DKIM, DMARC, reverse DNS, etc.)?

This is my first time pointing a domain’s A record to an external infrastructure, so I want to make sure I’m doing things correctly.

I’d really appreciate any advice, experience, or best practices :slightly_smiling_face:

Thanks a lot!


Titre : Domaine avec A record externe (Strapi) + mail via YunoHost : bonne pratique ?

Bonjour à toute la communauté YunoHost,

j’aurais besoin de vos conseils concernant le scénario suivant :

Je gère actuellement un VPS avec YunoHost, sur lequel tournent une dizaine de domaines avec leurs serveurs mail. Je dois maintenant ajouter un nouveau domaine, mais avec une particularité :
le domaine pointe (A record) vers l’adresse IP d’un service externe (Strapi Cloud). Le site web et le CMS sont donc entièrement hébergés en dehors de mon serveur YunoHost.

En revanche, je souhaite continuer à utiliser YunoHost pour :

  • le serveur mail
  • ainsi que les certificats Let’s Encrypt pour les services mail

Cela soulève plusieurs questions :

Habituellement, YunoHost attend que les enregistrements A/AAAA pointent vers le serveur afin de générer automatiquement les certificats. Dans mon cas, le domaine pointe volontairement vers une IP externe (Strapi), qui fournit déjà son propre certificat Let’s Encrypt.

Voici ce que j’envisage :

  • définir le MX record vers mail.domain.tld (au lieu de domain.tld, comme recommandé par YunoHost)
  • créer une sous-domaine mail.domain.tld pointant vers mon serveur YunoHost
  • générer un certificat Let’s Encrypt pour cette sous-domaine via YunoHost

Mes questions :

  • Cette approche est-elle correcte / considérée comme une bonne pratique ?
  • Dois-je créer explicitement la sous-domaine (mail.domain.tld) dans l’interface YunoHost et demander un certificat séparé ?
  • Les services mail (SMTP, IMAP, etc.) fonctionneront-ils correctement si seule la sous-domaine mail pointe vers YunoHost ?
  • Cette configuration peut-elle impacter mes autres domaines et serveurs mail existants ?
  • Y a-t-il des pièges particuliers à éviter (SPF, DKIM, DMARC, reverse DNS, etc.) ?

C’est la première fois que je dois faire pointer un A record vers une infrastructure externe, donc je préfère vérifier que je procède correctement.

Merci beaucoup pour vos retours et vos conseils :slightly_smiling_face:

Our approach actually makes sense and is a common setup when the website is hosted externally while mail stays on YunoHost.

I would recommend the following:

  1. Keep the main record pointing to your Strapi server.

  2. Create a subdomain like pointing to your YunoHost VPS.

  3. Set the MX record of the main domain to subdomain.

  4. Add both the main domain and the subdomain inside YunoHost.

  5. Generate the Let’s Encrypt certificate only for the subdomain.

This way, your website and mail stay separated cleanly, and SMTP/IMAP services should work normally. Several YunoHost users already use a similar “website external + mail on YunoHost” configuration successfully.

For DNS, don’t forget:

  • SPF record including your mail server

  • DKIM enabled from YunoHost

  • DMARC policy

  • reverse DNS matching the mail hostname

Using a reliable SMTP service provider like DigitalAka™ together with this structure can also help improve outgoing mail delivery and reduce spam issues for transactional emails.

This setup should not affect your existing domains if DNS records are configured correctly.