1

我使用以下图像在 Docker 容器中运行 iRedMail lejmr/iredmail-docker 根据官方说明,它可以启动为

    docker run -p 8079:80 -p 442:443 \
           -h mail.my-site.com \
           -e "MYSQL_ROOT_PASSWORD=pwd" \
           -e "SOGO_WORKERS=1" \
           -e "TZ=Europe/Moscow" \
           -e "POSTMASTER_PASSWORD={SSHA512}postpwd" \
           -e "IREDAPD_PLUGINS=['reject_null_sender', 'reject_sender_login_mismatch', 'throttle', 'amavisd_wblist', 'sql_alias_access_policy']" \
           -v /srv/iredmail/mysql:/var/lib/mysql \
           -v /srv/iredmail/vmail:/var/vmail \
           -v /srv/iredmail/clamav:/var/lib/clamav \
           --name=iredmail lejmr/iredmail:mysql-latest

上面的命令工作正常,我可以看到终端中正在运行 docker 容器,所有服务都正确启动。

我想通过第一个代理将请求作为普通 http 传递给邮件服务器,然后在 docker 容器 lejmr/iredmail-docker 中处理 https 连接。

这是我的 nginx.conf,它根本不重定向到 iredmail 站点。

关于如何将 http 邮件流量传递到主机上 docker 中运行的邮件服务器的任何想法?

load_module /usr/lib/nginx/modules/ngx_stream_module.so;
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    upstream mail {
        server 127.0.0.1:8079 fail_timeout=0;
    }

    server {
    server_name mail.my-site.com;
    listen 80;
    location / {
        # Use internal Docker DNS resolver IP
        # Internal AWS DNS resolver IP is your AWS VPC network range plus two
        resolver 127.0.0.11 valid=30s;
        proxy_set_header        Host $host:$server_port;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_redirect http:// https://;
        # Define upstream in variable to resolve 502 Bad Gateway error if the host is unavailable
        set $upstream_mail mail;
        proxy_pass              http://$upstream_mail;
        # Required for new HTTP-based CLI
        proxy_http_version 1.1;
        proxy_request_buffering off;
        proxy_buffering off; # Required for HTTP-based CLI to work over SSL
        }
    }

    # another modules with ssl behind this proxy
    include /etc/nginx/sites-enabled/*.conf;
    server_names_hash_bucket_size 64;
}




4

0 回答 0