Adding your first domain
At this point, we’ll be using Virtualmin’s interface to add a new domain. In the navigation panel on the left, click the “Create virtual server” link. Let’s add domain example.com:
Under “New virtual server details”, enter the domain name in the domain name text box. This is the complete domain we’re adding. In this example, we’ll enter “example.com” (without the quotes, and do not use a protocol identifier like “http://”). Enter a description of this website (optional). This will appear in lists as a friendly description of the domain. Enter an administration password. I leave Administration username set to automatic. A user by the name of “example” will be created if I leave it set to automatic.
If we want to create an e-mail account for firstname.lastname@example.org:
- Ensure “example.com” is selected in the combo-box in the left hand navigation pane. Click the “go” button to the right of the combo-box.
- Click the “Add a user to this server” link.
- Enter the new username in the e-mail address field so that it reads email@example.com.
- Enter the new user’s real name (Bill Smith).
- Enter the new user account password
- Leave all other default values
- Click “Create user”
This will create a system user for each e-mail account created, in the form of username.domain. For example, the steps performed above will create a system user bill.example. There are methods to move the user database from the system into a MySQL table, but that setup is outside of the scope of this article. I like to leave it as is for two reasons – I don’t have very many users on my domains, and it allows me to continue to use Virtualmin’s interface for easily adding new e-mail accounts.
You’ve successfully created an e-mail account. Your user should be able to connect to this e-mail server via imap using firstname.lastname@example.org as the username, the created password as the password, and hostname.domainname as the server name. In our example, user “bill” would choose “email@example.com” (or bill.example) as the username, the entered password as the password, and “mail.example.com” as the imap server name.
Since we now have an active mail server sitting live on the internet, let’s be responsible and test our smtp server for open relay and other vulnerabilities.
2 thoughts on “Configuring a cloud-based secure multi-domain web and e-mail server”
I use Exim as mail server and I installed opendkim using the instructions at
Awesome! To be perfectly honest, i went with postfix because it’s been the default I’ve seen installed with Virtualmin. Why did you choose to go with exim?