looking to install a mail server on a ubuntu server. I already have a web server running on it (apache/php/wordpress) But I am looking to also have a mail server. As I understand it I need to add MX records set up postfix for SMTP and dovecot for POP3 and IMAP.
My main question is, is it possible to install an email server on top of that?
Do I have to run the mail server with a second instance of apache or nginx?
Any tips for accomplishing this if at all possible?
Thank you
Yes, you can run a web server and a mail server on the same Ubuntu machine. That's a pretty common setup.
You will need:
Additionally you might want to have:
Mail server setup:
Setting up a mail server correctly is a pretty complex task. There's a lot you need to know (like DKIM, DMARC, and SPF) so other mail servers will trust you and your e-mails won't end in your receivers' spam filter.
Luckily there is this excellent guide from Cullum Smith: How To Run Your Own Mail Server
Clarification:
You only need one instance of a web server software, for example Apache, to server multiple websites. But there are configurations possible where you would in fact use two instances of web server software, like Apache AND nginx on the same machine. But that has nothing to do with running a mail server. People install this combination of Apache & nginx for performance and security reasons – like nginx handling the external communication, talking to the internet real fast and secure (called a reverse proxy) and apache handling the internal communication, to PHP, MySQL and your website's files.
Your mail server won't have contact to your Apache instance (unless you plan to implement webmail access).