How to setup nginx to proxy my smtp mail server

I am having nodejs SMTP server which I made using module “smtp-server”. It is running locally at using pm2 module and I wanted to know how can i configure it with nginx. Currently I am reffering to this site:

I ran complete example they gave me which is as follows:

worker_processes auto;

mail {
    auth_http   localhost:9000/cgi-bin/nginxauth.cgi;

    proxy_pass_error_message on;

    ssl                 on;
    ssl_certificate     /etc/ssl/certs/server.crt;
    ssl_certificate_key /etc/ssl/certs/server.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

    server {
        listen     25;
        protocol   smtp;
        smtp_auth  login plain cram-md5;

    server {
        listen    110;
        protocol  pop3;
        pop3_auth plain apop cram-md5;

     server {
        listen   143;
        protocol imap;

I wanted to know how to connnect my nodejs smtp server to nginx as the code above does not ask anywhere for url to smtp server.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
August 4, 2022

Hi there,

The Nginx Mail proxy is only available with NGINX Plus. Do you have NGINX Plus installed or do you have the standard NGINX service instead?

If this is the case, you would need to start by following the steps here on how to install NGINX Plus in order to get that to work:

Hope that this helps!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up