Skip to content

Qmailadmin on Nginx

nginx served qmailadmin login page

Configuration to run qmailadmin with nginx. I leave here the virtualhost configuration file as a reminder and in case it is useful to someone. This way you can to avoid installing apache if you do not need it.

This virtualhost works with nginx 1.14.2 althougth it shoud work with newer versions as well. In this example we use Qmailadmin 1.2.16 compiled with the following options and paths, adapt them to your needs:

./configure \
  --enable-htmldir=/usr/local/www/htdocs/qmail \
  --enable-cgibindir=/usr/local/www/htdocs/qmail/cgi-bin \
  --enable-cgipath=/cgi-bin/qmailadmin \
  --enable-imagedir=/usr/local/www/htdocs/qmail/qmailadmin/qmailadmin_img \
  --enable-imageurl=/qmailadmin_img \
  --enable-htmllibdir=/usr/local/www/htdocs/qmail/qmailadmin \
  --enable-qmaildir=/var/qmail \
  --enable-domain-autofill \
  --enable-vpopuser=vpopmail \
  --enable-vpopgroup=vchkpw \
  --enable-autoresponder-path=/usr/local/bin \
  --enable-ezmlmdir=/usr/local/bin/ezmlm \
  --enable-modify-quota \
  --disable-ezmlm-mysql \

extracted from here, part of the fantastic qmail notes from Roberto Puzzanghera.

server {
  listen 80 default_server;
  server_name example.tld;

  root  /usr/local/www/htdocs/qmail;

  location /cgi-bin { 
  gzip off;

  # Fastcgi socket
  fastcgi_pass  unix:/var/run/fcgiwrap.socket;

  # Fastcgi parameters, include the standard ones
  include /etc/nginx/fastcgi_params;

  # Adjust non standard parameters (SCRIPT_FILENAME)
  fastcgi_split_path_info (^/cgi-bin/qmailadmin[^/]*)(.*)$;
  fastcgi_param SCRIPT_FILENAME  /usr/local/www/htdocs/qmail/cgi-bin/qmailadmin;
  fastcgi_param PATH_INFO $fastcgi_path_info;


  location @rewrite {
    rewrite ^ /cgi-bin/qmailadmin permanent;

  location / {
    try_files $uri @rewrite;

  location /qmailadmin_img/ {
    root  /usr/local/www/htdocs/qmail/qmailadmin;

It uses fcgiwrap to execute the qmailadmin cgi script in nginx. Probably this can be better tuned, but works for me and hope that for you too. Please adapt it to your needs. Comments are welcome.

2 thoughts on “Qmailadmin on Nginx”

  1. Thank you. You saved my day. A costumer of mine wanted everything under nginx, of which I know nothing, and I found the correct infos in this post, which mentions my own website among the other things! Isn’t great how networking works?

    1. Hi Roberto, thanks for your comment, I really appreciate it. I am glad I have been able to help you somehow, so I can give you back something in change of all qmail knowledge you spread.

      I have been using your notes for a lot of years to run mail servers with no issue and I thank you for all the info in your site. Surprised and happy at the same time to see your comment, keep the good job. Greetings!

Leave a Reply

Your email address will not be published. Required fields are marked *