Question

How to add subdomain on centos7

I am trying to create a mail server but I couldn’t create a subdomain like mail.site.com

On cloudflare, I added my ipv4 adress and now mail.site.com shows the main domain folder.

I am using apache and centos7


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thanks for your answer. I have a sharing hosting on a different hosting platform. Now I decided that I can use digitalocean for xxx.com and sharing hosting for mail.xxx.com

If someone wants to do it, just add mx, cname and srv records on dns configuration.

Hi @dtorgul,

Firstly, you’ll need to decide if you wish to create a mail server functionality to your existing droplet or create a new droplet from the start.

At the moment your mail.site.com loads your site.com as you don’t have an Apache Vhost. If you are not sure how to set those up, I’ll recommend checking out the following article:

https://www.digitalocean.com/community/tutorial_collections/how-to-set-up-apache-virtual-hosts

Now, that we’ve covered that, we can turn our attention to the mail functionality. If you only want to send e-mails without having an actual mailbox, I’ll recommend using Postfix as a Send only service. To do this, you can follow this tutorial:

Postfix

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-18-04

If you want to have mailboxes and manage your e-mails, again you can use Postfix however you’ll need to add dovecot as well. For this,I’ll recommend following this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassassin

Regards, KDSys