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.

Leave a Reply

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