Question

How to add subdomain on centos7

Posted May 18, 2020 128 views
CentOSApache

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

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.

×
2 answers

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

by Nestor de Haro
In this tutorial we are going to configure a mail server using Postfix, Dovecot, MySQL, and SpamAssassin on Ubuntu 12.04.

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.

Submit an Answer