{
echo "server {
    listen $ADMIN_IP4:80 ;
    listen [$ADMIN_IP6]:80 ;
    return 301 https://\$host\$request_uri;
}

server {
    server_name $REALMADMINHTTPD;
    # SSL configuration
    #
    ssl on;
    listen $ADMIN_IP4:443 ssl ;
    listen [$ADMIN_IP6]:443 ssl ;
    ssl_certificate $PEMSRVDIR/$REALMADMINHTTPD.pem;
    ssl_certificate_key $PEMSRVDIR/$REALMADMINHTTPD.pem;
    root $DIRadminHTML;
    index index.html index.php;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files \$uri \$uri/ =404;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php\$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:$FPMSOCK;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }
}

server {
    server_name duckduckgo.com ;
    # SSL configuration
    #
    ssl on;
    listen $ADMIN_IP4:443 ssl ;
    listen [$ADMIN_IP6]:443 ssl ;
    ssl_certificate $PEMSRVDIR/duckduckgo.pem;
    ssl_certificate_key $PEMSRVDIR/duckduckgo.pem;
    return 301 https://safe.duckduckgo.com\$request_uri;
}

server {
    server_name www.qwant.com ;
    # SSL configuration
    #
    ssl on;
    listen $ADMIN_IP4:443 ssl ;
    listen [$ADMIN_IP6]:443 ssl ;
    ssl_certificate $PEMSRVDIR/qwant.pem;
    ssl_certificate_key $PEMSRVDIR/qwant.pem;
    return 301 https://www.qwantjunior.com\$request_uri;
}

server {
    server_name \$host;
    listen $PRIVATE_IP4:80 ;
    listen [$PRIVATE_IP6]:80 ;
    root $DIRHTML;
    index index.html index.php;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files \$uri \$uri/ /index.php;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php\$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:$FPMSOCK;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }

}

server {
    server_name \$host;
    ssl on;
    listen $PRIVATE_IP4:443 ssl ;
    listen [$PRIVATE_IP6]:443 ssl ;
    ssl_certificate $PEMSRVDIR/privet.ct.local.pem;
    ssl_certificate_key $PEMSRVDIR/privet.ct.local.pem;
    root $DIRHTML;
    index index.html index.php;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
            try_files \$uri \$uri/ /index.php;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php\$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:$FPMSOCK;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }

}
"
    } > "$CTPARENTALCONFHTTPD"
