Poste.io
Note: Steps in this article have been followed on Ubuntu 18.04 server machine.
Setting up of email server is considered to be one of the most difficult tasks to do. There have been number of efforts to make this process easy and secure. Some of the notable projects are:
By far the simplest server to setup that I found was Poste.io. Here is how I did it.
Requirements
Hardware
-
64bit linux distribution
-
CPU and free RAM
Poste.io did not mention minimum requirement in this case. I myself used 2 CPU 8GB RAM machine.
Software
-
NGINX
You can of course use Apache. This tutorial only uses Nginx.
-
Docker
-
Docker-Compose
Steps
- Create user
- Install Nginx
- Setup Firewall
- Install Docker
- Install Docker-Compose
- Create
docker-compose.yml
- Instantiate docker instance
- Configure Nginx as reverse proxy
Create User
|
|
follow the steps in the prompt, then assign sudo privileges by executing the following command.
|
|
Install Nginx
Install Nginx using following commands:
|
|
Setup Firewall (or enable default firewall)
List all applications' profiles
|
|
Allow ssh
|
|
Enable ufw
|
|
Allow Nginx on port 80 (HTTP) and 443(HTTPS)
|
|
Check status of ufw
|
|
Install Docker
Install docker using following commands:
|
|
Install docker-compose
Install docker-compose using following commands:
|
|
Create docker-compose.yml
Create docker-compose.yml
in some folder and navigate in terminal to that folder. Lets assume, we choose to create a folder in /home directory.
|
|
Enter the following content to docker-compose.yml
file:
|
|
Please notice:
- image is
analogic/poste.io
. Poste.io offers two docker images, oneposte.io/mailserver
is a PRO version and otheranalogic/poste.io
is a FREE version. We will be using the free version. - We are mapping docker container’s port 80 with port 82 of our host machine. Similarly, 443 of container with 445 of our host. Since, host’s port 80 and 443 will be used by Nginx for reverse proxy.
restart: always
tells docker service to run this container whenever OS starts.
Instantiate docker instance
To instantiate (in detached mode), execute:
|
|
You can instead execute the following command to see the logs:
|
|
Configure Nginx as reverse proxy
Create an Nginx config file by executing:
|
|
Enter the following content
|
|
Please notice:
server_name
is the subdomain we entered in step 6.proxy_pass
is the ip address of the poste container. You can find by executingdocker inspect [container id]
.
Note: You can optionally use certbot to setup HTTPS.
Комментарии