[GH-ISSUE #362] When accessing UI through nginx proxy, just get a white screen. #241

Closed
opened 2026-03-15 13:23:20 +03:00 by kerem · 6 comments
Owner

Originally created by @penright on GitHub (Sep 13, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/362

I hope it is ok to ask a question here.
I am guessing it has to be a configuration issue or I am misunderstanding the web UI.

Docker compose for mailpit

  mailpit:
    image: axllent/mailpit
    container_name: mailpit
    restart: unless-stopped
    volumes:
      - $PWD/storage/production_files/mailpit/data:/data
    #ports:
    #- 8025:8025
    #- 1025:1025
    environment:
      - MP_MAX_MESSAGES=5000
      - MP_DATABASE=/data/mailpit.db
      - MP_SMTP_AUTH_ACCEPT_ANY=1
      - MP_SMTP_AUTH_ALLOW_INSECURE=1
      - TZ=America/Chicago
    networks:
      - api-v3

The nginx

  nginx:
    container_name: nginx
    image: nginx:alpine
    environment:
      - TZ=America/Chicago
    depends_on:
      - php
    restart: unless-stopped
    ports:
      - ${NGINX_PORT:-443}:${NGINX_PORT:-443}
      - ${NGINX_PORT:-80}:${NGINX_PORT:-80}
    volumes:
      - $PWD/storage/web/etc/nginx/conf.d/:/etc/nginx/conf.d/
      - $PWD/storage/web/var/www/certbot/:/var/www/certbot/
      - $PWD/storage/web/var/www/app/:/var/www/app/
      - $PWD/storage/web/etc/letsencrypt/:/etc/letsencrypt/
    networks:
      - api-v3
     

The nginx config root is /var/www/app for the larvavel project. There was not one in the example, so I assumed that I needed to add one to the location.

    location /mailpit {
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/conf.d/.htpasswd;

        proxy_pass http://mailpit:8025/;
        root /;

        # configure the websocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }

and here is what the nginx logs look like

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/09/13 11:57:55 [notice] 1#1: using the "epoll" event method
2024/09/13 11:57:55 [notice] 1#1: nginx/1.27.1
2024/09/13 11:57:55 [notice] 1#1: built by gcc 13.2.1 20240309 (Alpine 13.2.1_git20240309)
2024/09/13 11:57:55 [notice] 1#1: OS: Linux 6.8.0-44-generic
2024/09/13 11:57:55 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/09/13 11:57:55 [notice] 1#1: start worker processes
2024/09/13 11:57:55 [notice] 1#1: start worker process 29
2024/09/13 11:57:55 [notice] 1#1: start worker process 30
2024/09/13 11:57:55 [notice] 1#1: start worker process 31
2024/09/13 11:57:55 [notice] 1#1: start worker process 32
98.173.248.213 - bradmin [13/Sep/2024:11:58:14 -0500] "GET /mailpit HTTP/1.1" 200 474 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
98.173.248.213 - bradmin [13/Sep/2024:11:58:14 -0500] "GET /dist/app.css?v1.20.4 HTTP/1.1" 404 164 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
98.173.248.213 - bradmin [13/Sep/2024:11:58:14 -0500] "GET /dist/app.js?v1.20.4 HTTP/1.1" 404 163 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"

Originally created by @penright on GitHub (Sep 13, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/362 I hope it is ok to ask a question here. I am guessing it has to be a configuration issue or I am misunderstanding the web UI. Docker compose for mailpit ``` mailpit: image: axllent/mailpit container_name: mailpit restart: unless-stopped volumes: - $PWD/storage/production_files/mailpit/data:/data #ports: #- 8025:8025 #- 1025:1025 environment: - MP_MAX_MESSAGES=5000 - MP_DATABASE=/data/mailpit.db - MP_SMTP_AUTH_ACCEPT_ANY=1 - MP_SMTP_AUTH_ALLOW_INSECURE=1 - TZ=America/Chicago networks: - api-v3 ``` The nginx ``` nginx: container_name: nginx image: nginx:alpine environment: - TZ=America/Chicago depends_on: - php restart: unless-stopped ports: - ${NGINX_PORT:-443}:${NGINX_PORT:-443} - ${NGINX_PORT:-80}:${NGINX_PORT:-80} volumes: - $PWD/storage/web/etc/nginx/conf.d/:/etc/nginx/conf.d/ - $PWD/storage/web/var/www/certbot/:/var/www/certbot/ - $PWD/storage/web/var/www/app/:/var/www/app/ - $PWD/storage/web/etc/letsencrypt/:/etc/letsencrypt/ networks: - api-v3 ``` The nginx config root is /var/www/app for the larvavel project. There was not one in the example, so I assumed that I needed to add one to the location. ``` location /mailpit { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf.d/.htpasswd; proxy_pass http://mailpit:8025/; root /; # configure the websocket proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } ``` and here is what the nginx logs look like ``` /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh /docker-entrypoint.sh: Configuration complete; ready for start up 2024/09/13 11:57:55 [notice] 1#1: using the "epoll" event method 2024/09/13 11:57:55 [notice] 1#1: nginx/1.27.1 2024/09/13 11:57:55 [notice] 1#1: built by gcc 13.2.1 20240309 (Alpine 13.2.1_git20240309) 2024/09/13 11:57:55 [notice] 1#1: OS: Linux 6.8.0-44-generic 2024/09/13 11:57:55 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 2024/09/13 11:57:55 [notice] 1#1: start worker processes 2024/09/13 11:57:55 [notice] 1#1: start worker process 29 2024/09/13 11:57:55 [notice] 1#1: start worker process 30 2024/09/13 11:57:55 [notice] 1#1: start worker process 31 2024/09/13 11:57:55 [notice] 1#1: start worker process 32 98.173.248.213 - bradmin [13/Sep/2024:11:58:14 -0500] "GET /mailpit HTTP/1.1" 200 474 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" 98.173.248.213 - bradmin [13/Sep/2024:11:58:14 -0500] "GET /dist/app.css?v1.20.4 HTTP/1.1" 404 164 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" 98.173.248.213 - bradmin [13/Sep/2024:11:58:14 -0500] "GET /dist/app.js?v1.20.4 HTTP/1.1" 404 163 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" ```
kerem 2026-03-15 13:23:20 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@axllent commented on GitHub (Sep 13, 2024):

Hi @penright, definitely the right place to ask. So you're proxying /mailpit to the Mailpit container, however you also need to tell Mailpit that. The Mailpit environment option you're looking for is MP_WEBROOT (see https://mailpit.axllent.org/docs/configuration/runtime-options/).

I don't know what the NginX root /; does, but I strongly suspect your don't need it.

Hope this helps!

<!-- gh-comment-id:2350100476 --> @axllent commented on GitHub (Sep 13, 2024): Hi @penright, definitely the right place to ask. So you're proxying `/mailpit` to the Mailpit container, however you also need to tell Mailpit that. The Mailpit environment option you're looking for is `MP_WEBROOT` (see https://mailpit.axllent.org/docs/configuration/runtime-options/). I don't know what the NginX `root /;` does, but I strongly suspect your don't need it. Hope this helps!
Author
Owner

@penright commented on GitHub (Sep 13, 2024):

I tried many different combinations and that is what I last tried. :-)
I saw we web root env var. It said the default was /. The example was /mail.
image

So would I set the web root env var to /mail? If so in the docker-compose, do I need to persist that dir?
Then the nginx root would be /mail?

if I docker exec -it into the mailpit container, where would I find the dir?

<!-- gh-comment-id:2350134232 --> @penright commented on GitHub (Sep 13, 2024): I tried many different combinations and that is what I last tried. :-) I saw we web root env var. It said the default was /. The example was /mail. ![image](https://github.com/user-attachments/assets/b74be481-0e07-4474-9725-7c3154de4b0b) So would I set the web root env var to /mail? If so in the docker-compose, do I need to persist that dir? Then the nginx root would be /mail? if I docker exec -it into the mailpit container, where would I find the dir?
Author
Owner

@axllent commented on GitHub (Sep 13, 2024):

If you have proxied /mailpit to Mailpit, then your webroot in Mailpit would be mailpit. Does that not work?

<!-- gh-comment-id:2350230480 --> @axllent commented on GitHub (Sep 13, 2024): If you have proxied `/mailpit` to Mailpit, then your webroot in Mailpit would be `mailpit`. Does that not work?
Author
Owner

@axllent commented on GitHub (Sep 13, 2024):

Sorry, the second question you had is where you would find the dir. There is no dir, it's all coming from within the Mailpit binary itself. Mailpit has those files inside itself, so serves them back to the browser. This is why you need to tell Mailpit if you are using an alternative webroot.

<!-- gh-comment-id:2350240555 --> @axllent commented on GitHub (Sep 13, 2024): Sorry, the second question you had is where you would find the dir. There is no dir, it's all coming from within the Mailpit binary itself. Mailpit has those files inside itself, so serves them back to the browser. This is why you need to tell Mailpit if you are using an alternative webroot.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 21, 2024):

This issue has been marked as stale because it has been open for 7 days with no activity.

<!-- gh-comment-id:2364917274 --> @github-actions[bot] commented on GitHub (Sep 21, 2024): This issue has been marked as stale because it has been open for 7 days with no activity.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 24, 2024):

This issue was closed because there has been no activity since being marked as stale.

<!-- gh-comment-id:2369955874 --> @github-actions[bot] commented on GitHub (Sep 24, 2024): This issue was closed because there has been no activity since being marked as stale.
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/mailpit#241
No description provided.