Report this

What is the reason for this report?

How to add subdomain on centos7

Posted on May 18, 2020

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



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!

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.

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

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.