[GH-ISSUE #1097] 502 Bad Gateway when using Nginx Proxy Manager and Mailu #905

Closed
opened 2026-02-26 06:34:52 +03:00 by kerem · 1 comment
Owner

Originally created by @apainter2 on GitHub (May 13, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1097

I have mailu setup and working, but I would prefer to run it behind a Nginx Reverse Proxy.

I am getting '502 Bad Gateway' for the root address, as well as /webmail, /admin and /admin/ui

Running mailui 1.7 with npm

I am running under docker containerd, and my docker-compose file for the mailu instance 'front' looks like this:

 # Core services
  front:
    image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.7}
    restart: always
    env_file: /home/user/docker_files/mailu/mailu.env
    logging:
      driver: json-file
    ports:
      - "127.0.0.1:8080:80"
      - "127.0.0.1:8443:443"
      - "108.61.196.228:25:25"
      - "108.61.196.228:465:465"
      - "108.61.196.228:587:587"
      - "108.61.196.228:110:110"
      - "108.61.196.228:995:995"
      - "108.61.196.228:143:143"
      - "108.61.196.228:993:993"

doing a 'ss -ltup' on the console to verify that the mailu webserver for ports 8080 and 8443 are listening show:

sudo ss -ltupn
Netid                       State                        Recv-Q                        Send-Q                                                     Local Address:Port                                                Peer Address:Port                       Process
udp                         UNCONN                       0                             0                                                          127.0.0.53%lo:53                                                       0.0.0.0:*                           users:(("systemd-resolve",pid=537,fd=12))
udp                         UNCONN                       0                             0                                                    xxx.xxx.xxx.xxx%ens3:68                                                       0.0.0.0:*                           users:(("systemd-network",pid=407,fd=19))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:110                                                      0.0.0.0:*                           users:(("docker-proxy",pid=122038,fd=4))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:143                                                      0.0.0.0:*                           users:(("docker-proxy",pid=121994,fd=4))
tcp                         LISTEN                       0                             4096                                                           127.0.0.1:8080                                                     0.0.0.0:*                           users:(("docker-proxy",pid=121934,fd=4))
tcp                         LISTEN                       0                             4096                                                             0.0.0.0:80                                                       0.0.0.0:*                           users:(("docker-proxy",pid=120878,fd=4))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:465                                                      0.0.0.0:*                           users:(("docker-proxy",pid=121982,fd=4))
tcp                         LISTEN                       0                             4096                                                             0.0.0.0:81                                                       0.0.0.0:*                           users:(("docker-proxy",pid=120860,fd=4))
tcp                         LISTEN                       0                             4096                                                             0.0.0.0:30033                                                    0.0.0.0:*                           users:(("docker-proxy",pid=21874,fd=4))
tcp                         LISTEN                       0                             4096                                                       127.0.0.53%lo:53                                                       0.0.0.0:*                           users:(("systemd-resolve",pid=537,fd=13))
tcp                         LISTEN                       0                             128                                                              0.0.0.0:22                                                       0.0.0.0:*                           users:(("sshd",pid=626,fd=3))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:25                                                       0.0.0.0:*                           users:(("docker-proxy",pid=122062,fd=4))
tcp                         LISTEN                       0                             4096                                                           127.0.0.1:8443                                                     0.0.0.0:*                           users:(("docker-proxy",pid=121922,fd=4))
tcp                         LISTEN                       0                             4096                                                             0.0.0.0:443                                                      0.0.0.0:*                           users:(("docker-proxy",pid=120842,fd=4))
tcp                         LISTEN                       0                             4096                                                             0.0.0.0:10011                                                    0.0.0.0:*                           users:(("docker-proxy",pid=21892,fd=4))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:993                                                      0.0.0.0:*                           users:(("docker-proxy",pid=121958,fd=4))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:995                                                      0.0.0.0:*                           users:(("docker-proxy",pid=121946,fd=4))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:2376                                                     0.0.0.0:*                           users:(("dockerd",pid=6445,fd=8))
tcp                         LISTEN                       0                             4096                                                      aaa.bbb.ccc.ddd:587                                                      0.0.0.0:*                           users:(("docker-proxy",pid=121970,fd=4))

The custom ngnix configuration for the proxy host:

location / {
  proxy_pass http://127.0.0.1:8080;
  proxy_redirect https://127.0.0.1 https://mail.mydomain.tld;

Below are some screen grabs of the Nginx Proxy Manager configuration for the proxy settings:
1

and
2

There are no mailu error logs, as the web browser is not hitting the mailu_front_1 instance.

Does anyone have any advise on how to go about configuring nginx proxy manager and mailu to play nice with each other?

Originally created by @apainter2 on GitHub (May 13, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1097 I have mailu setup and working, but I would prefer to run it behind a Nginx Reverse Proxy. I am getting '502 Bad Gateway' for the root address, as well as /webmail, /admin and /admin/ui Running mailui 1.7 with npm I am running under docker containerd, and my docker-compose file for the mailu instance 'front' looks like this: ``` # Core services front: image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.7} restart: always env_file: /home/user/docker_files/mailu/mailu.env logging: driver: json-file ports: - "127.0.0.1:8080:80" - "127.0.0.1:8443:443" - "108.61.196.228:25:25" - "108.61.196.228:465:465" - "108.61.196.228:587:587" - "108.61.196.228:110:110" - "108.61.196.228:995:995" - "108.61.196.228:143:143" - "108.61.196.228:993:993" ``` doing a 'ss -ltup' on the console to verify that the mailu webserver for ports 8080 and 8443 are listening show: ``` sudo ss -ltupn Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=537,fd=12)) udp UNCONN 0 0 xxx.xxx.xxx.xxx%ens3:68 0.0.0.0:* users:(("systemd-network",pid=407,fd=19)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:110 0.0.0.0:* users:(("docker-proxy",pid=122038,fd=4)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:143 0.0.0.0:* users:(("docker-proxy",pid=121994,fd=4)) tcp LISTEN 0 4096 127.0.0.1:8080 0.0.0.0:* users:(("docker-proxy",pid=121934,fd=4)) tcp LISTEN 0 4096 0.0.0.0:80 0.0.0.0:* users:(("docker-proxy",pid=120878,fd=4)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:465 0.0.0.0:* users:(("docker-proxy",pid=121982,fd=4)) tcp LISTEN 0 4096 0.0.0.0:81 0.0.0.0:* users:(("docker-proxy",pid=120860,fd=4)) tcp LISTEN 0 4096 0.0.0.0:30033 0.0.0.0:* users:(("docker-proxy",pid=21874,fd=4)) tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=537,fd=13)) tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=626,fd=3)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:25 0.0.0.0:* users:(("docker-proxy",pid=122062,fd=4)) tcp LISTEN 0 4096 127.0.0.1:8443 0.0.0.0:* users:(("docker-proxy",pid=121922,fd=4)) tcp LISTEN 0 4096 0.0.0.0:443 0.0.0.0:* users:(("docker-proxy",pid=120842,fd=4)) tcp LISTEN 0 4096 0.0.0.0:10011 0.0.0.0:* users:(("docker-proxy",pid=21892,fd=4)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:993 0.0.0.0:* users:(("docker-proxy",pid=121958,fd=4)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:995 0.0.0.0:* users:(("docker-proxy",pid=121946,fd=4)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:2376 0.0.0.0:* users:(("dockerd",pid=6445,fd=8)) tcp LISTEN 0 4096 aaa.bbb.ccc.ddd:587 0.0.0.0:* users:(("docker-proxy",pid=121970,fd=4)) ``` The custom ngnix configuration for the proxy host: ``` location / { proxy_pass http://127.0.0.1:8080; proxy_redirect https://127.0.0.1 https://mail.mydomain.tld; ``` Below are some screen grabs of the Nginx Proxy Manager configuration for the proxy settings: ![1](https://user-images.githubusercontent.com/66255771/118192629-57445480-b43e-11eb-80fa-d0af2c3efb28.PNG) and ![2](https://user-images.githubusercontent.com/66255771/118192643-5b707200-b43e-11eb-8662-c0e3708c461a.PNG) There are no mailu error logs, as the web browser is not hitting the mailu_front_1 instance. Does anyone have any advise on how to go about configuring nginx proxy manager and mailu to play nice with each other?
kerem closed this issue 2026-02-26 06:34:53 +03:00
Author
Owner

@apainter2 commented on GitHub (May 21, 2021):

I've made a fill write up on how this was resolved for those who have something similar, over on the mailu git repo issue page, here is the link, it has a full thread discussion on the fix etc.

https://github.com/Mailu/Mailu/issues/1807

<!-- gh-comment-id:846252841 --> @apainter2 commented on GitHub (May 21, 2021): I've made a fill write up on how this was resolved for those who have something similar, over on the mailu git repo issue page, here is the link, it has a full thread discussion on the fix etc. https://github.com/Mailu/Mailu/issues/1807
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#905
No description provided.