Repository navigation
Not possible to use Nginx version 1.31.6 as mailproxy #1827
Description
Bug Overview
Ubuntu Linux 24.04.5
Although Nginx version 1.31.6 is compiled with the options -with-mail and all the other things needed, the directive mail in the nginx.conf file is not allowed.
Also the /cgi-bin/nginxauth.cgi is missing in the system
Expected Behavior
Configure the mail proxy and get things working
Steps to Reproduce the Bug
Add the parameters as seen https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/
Then do the test NGINX -T
NGINX Configuration
Nginx version 1.31.6 on Ubuntu 24.04.5
NGINX version and build configuration options
nginx -V
nginx version: nginx/1.31.6
built by gcc 13.3.0 (Ubuntu 13.3.0-6ubuntu224.04.1)noble -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
built with OpenSSL 3.0.13 30 Jan 2024
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --lock-path=/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-control-api --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_json_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_v3_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/home/builder/debuild/nginx-1.31.6/debian/debuild-base/nginx-1.31.6=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/home/builder/debuild/nginx-1.31.6/debian/debuild-base/nginx-1.31.6=/usr/src/nginx-1.31.6-1
Environment where NGINX is being built and/or deployed
Ubuntu 24.04.5
Architecture where NGINX is being built and/or deployed
uname -a
Linux backup0 6.8.0-146-generic #146-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 3 16:12:30 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
NGINX Debug Log
none
Additional Context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
Activity
github-actions commentedon Oct 7, 2026
👋 Thanks for opening this issue and contributing to the NGINX project!
A maintainer will review it and follow up when possible. We appreciate your support.
saikrishnakumarreddy commentedon Oct 8, 2026
The
maildirective is available when compiled with--with-mail(which your build includes). The error you're seeing is likely a configuration mistake, please share the actual error fromnginx -tand yourmail {}block.The
nginxauth.cgiscript is not part of nginx. It's an example authentication backend that you need to implement yourself. See the mail proxy documentation.GentleRV commentedon Oct 11, 2026
Please, take my issue serrious.
You really think I don;t know how to test a configuration be fore use it?
Everything is as written and NO it does not work
saikrishnakumarreddy commentedon Oct 11, 2026
We are not able to reproduce this, the
maildirective works as expected when built with--with-mail. Please share the actualnginx -toutput and yourmail {}configuration so we can investigate further.GentleRV commentedon Oct 12, 2026
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
With the mail extras in /etc/nginx/nginx.conf:
mail {
server_name mail.dutondata.com;
auth_http localhost:9000/cgi-bin/nginxauth.cgi;
}
Then again sudo nginx -t
sudo nginx -t
nginx: [emerg] "mail" directive is not allowed here in /etc/nginx/nginx.conf:32
nginx: configuration file /etc/nginx/nginx.conf test failed
What I do wrong?
saikrishnakumarreddy commentedon Oct 12, 2026
The error "mail" directive is not allowed here means your
mail {}block would be placed inside thehttp {}block. Themail {}block must be at the top level ofnginx.conf, as a sibling ofhttp {}, not nested inside it.Please share your full
nginx.confif that's not the case.