This guide helps you set up a simple web application to manage email forwarders on MXroute servers. It uses a self-contained Docker setup, which is great for running on a home server or NAS without needing to install extra software.
- Download the files: Get the
mxroute-forwarderapplication files. - Place the files: Put the Docker files (
Dockerfile,docker-compose.yml) in the same folder as your application's PHP files. - Launch the app: Open a terminal in that folder and run this command:
docker-compose up -d --build
- Access the application: Once the command is finished, open your web browser and go to
http://your-server-ip:3311.
Your project folder should be set up like this:
mxroute-forwarder/
├── Dockerfile
├── docker-compose.yml
├── config.php
├── DirectAdminAPI.php
├── index.php
└── manage_forwarder.php
The application is set to be accessible on port 3311 by default. To change this, you'll need to edit the docker-compose.yml file.
- Open the file in a text editor.
- Find the
ports:section. It looks like this:ports: - "3311:80"
- Change only the first number to your desired port. The second number (
80) must always stay the same, as it's the port inside the Docker container. - After saving the file, you'll need to rebuild and restart the container to apply the change:
docker-compose down docker-compose up -d --build
You must tell the application which MXroute server to connect to. To do this:
- Open the
config.phpfile. - Find this line:
define('DEFAULT_DA_SERVER', 'glacier.mxrouting.net');
- Change
'glacier.mxrouting.net'to your specific MXroute server address. You can find this in your welcome email or DirectAdmin dashboard.
Here are some commands you'll use frequently to manage the container:
- Start the application:
docker-compose up -d --build - Stop the application:
docker-compose down - View what's happening:
docker-compose logs -f - Restart the application:
docker-compose restart - Rebuild and restart:
docker-compose down && docker-compose up -d --build
If you download new PHP files for the application, you need to update your Docker container to use them.
- Replace the old files in your project folder with the new ones.
- Rebuild the container with this command:
This process stops the old container and creates a new one with the updated files.
docker-compose down && docker-compose up -d --build
This Docker setup works well on many popular network-attached storage (NAS) devices.
- Synology NAS: Use Container Manager or SSH. The default port
3311should work fine. Access it athttp://your-synology-ip:3311. - QNAP NAS: Use Container Station or SSH. You may need to check your firewall settings to make sure the port is open. Access it at
http://your-qnap-ip:3311. - TrueNAS/FreeNAS: Use the Apps section or SSH. Ensure that port
3311isn't blocked by your firewall. Access it athttp://your-truenas-ip:3311.
- Check the logs: Run
docker-compose logsto see what went wrong. - Is the port in use? Another application might be using the port you've chosen. To check, run
sudo lsof -i :3311(replace3311with your port).
- Is the container running? Use
docker-compose psto see the status. It should show asUp. - Check your NAS firewall: Make sure the port you're using isn't blocked.
- Check the logs again: Run
docker-compose logs -fto watch for real-time errors as you try to connect.
- This often happens if the Docker process can't read your files. Try fixing the file permissions with
chmod -R 755 .before you build the container.
- You must have Docker and Docker Compose installed on your server.
- You need an MXroute account with DirectAdmin access.
- Your server must be able to connect to the MXroute servers over the internet.