daemon off;
worker_processes 1;

#XXX-Cedric: TODO separate the different logs
error_log %(error-log)s info;

events {
        worker_connections 1024;
        use epoll;
}

http {
        log_format main
                '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $bytes_sent '
                '"$http_referer" "$http_user_agent" '
                '"$gzip_ratio"';

        server {
                listen %(listen-local-ipv4)s:8008;
                server_name localhost;
                access_log %(access-log)s main;
                error_log %(error-log)s info;

                root %(htdocs)s;

                location ~ $ {
                        add_header Auth-Server %(smtp-upstream-host)s;
                        add_header Auth-Port %(smtp-upstream-port)s;
                        return 200;
                }
        }
}

mail {
        server_name %(domain-name)s;

        auth_http %(listen-local-ipv4)s:8008;

        server {
                listen %(listen-local-ipv4)s:%(smtp-port-number)s;
                listen %(listen-global-ipv6)s:%(smtp-port-number)s;
                protocol smtp;
                timeout 5s;
                proxy on;
                xclient off;
                smtp_auth none;
        }
}
