Press "Enter" to skip to content

Category: Utilities

qmailadmin on nginx

Hi there! After many tests I managed to run qmailadmin on nginx. I leave here the virtualhost configuration file as a reminder in case it is useful to someone in order to avoid installing apache if you do not need it.

The virtualhost works with nginx 1.14.2 and qmailadmin 1.2.16 compiled with the following options/paths:

./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 under nginx. Probably this can be better tuned, but works for me and hope that for you too, adapt it to your needs. Comments are welcomed.

Leave a Comment

Remote Tcpdump over ssh and wireshark

Here you have a very useful command for when you want to analyze traffic remotely with tcpdump over ssh using wireshark.

ssh root@ tcpdump -i any -U -s0 -w - 'not port 22' | wireshark -k -i -

The idea is to run tcpdump on the remote server over ssh, send that capture in real time through this encrypted connection and view it on our local computer with wireshark, a graphical package inspector with many interesting features.

Leave a Comment