Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login page not functional (nginx reverse proxy, custom port) #1590

Closed
meljoann opened this issue Nov 12, 2023 · 9 comments
Closed

login page not functional (nginx reverse proxy, custom port) #1590

meljoann opened this issue Nov 12, 2023 · 9 comments
Labels
question Further information is requested

Comments

@meljoann
Copy link

Hi, I got listmonk installed and it's running perfectly on my local machine.

On a VPS, it looks like this:
Screenshot (36)

It seems to let me log in, but the admin page is totally blank. And as you can see, the links are the default port.

I've tried both binary and docker installs with the same result.

I'm running:

  • nginx reverse proxy
  • custom port

config.toml has:

address = "0.0.0.0:9002"
...
# Database.
[db]
host = "127.0.0.1"`´

and everything else is default.

nginx:

  location /listmonk/ {
        proxy_pass  http://127.0.0.1:9002/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
@knadh
Copy link
Owner

knadh commented Nov 13, 2023

location /listmonk/ -- This isn't supported, unfortunately due to a limitation in how the Vue frontend app works. listmonk has to be installed at the root (/) of a domain. Please use a subdomain like listmonk.yoursite.net

More context here: #174

@knadh knadh closed this as completed Nov 13, 2023
@knadh knadh added the question Further information is requested label Nov 13, 2023
@meljoann
Copy link
Author

Thanks so much! Will do 👍

@MaximilianKohler
Copy link
Contributor

MaximilianKohler commented Nov 13, 2023

Hmm, let me know if you solve it. I was having the exact same problem despite using a subdomain as knadh recommended. #1573

I see that you're editing config.toml but the directions I was given were to only edit docker-compose.yml. #1573 (comment)

EDIT: It was a firewall issue. I disabled my firewall and it works.

@meljoann
Copy link
Author

meljoann commented Nov 14, 2023

Yeah, there was no way I could see to add the subdomain URL to config.toml, so I found these environment variables and this old docker-compose.yml, and added site_url to my docker-compose.yml.

Now I've upgraded my situation to an nginx 502 error haha

I see others have got it running using a subdomain, but I don't know what else I can try now. Not sure what's so different about our setups?

@MaximilianKohler
Copy link
Contributor

Yeah, @Sebastix got it running here #1004 (comment) but isn't responding.

I'm using a subdomain, not subpath, but this guy got a subpath working #174 (comment). Though I don't understand what he's doing.

I'm trying to get it running on an nginx vhost.

@meljoann
Copy link
Author

meljoann commented Nov 15, 2023

@MaximilianKohler I got it working! In my case, I didn't realise the port in config.toml needed to be the default 9000 port inside the docker container, not my custom outside port.

Here's what I have, in case there's anything there that you didn't try already:

nginx:

server {
	    listen              443 ssl;
		server_name			listmonk.example.com; 

  location / {
        proxy_pass  http://127.0.0.1:9003;
     proxy_set_header   Host            $http_host;
     proxy_set_header   X-Real-IP       $remote_addr;
     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;  
    }

}

server {
    listen              80;
	server_name			listmonk.example.com; 
	  location / {
return 301 https://$host$request_uri;
	  }
}

Dockerfile:

FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /listmonk
COPY listmonk .
CMD ["./listmonk"]
EXPOSE 9000

config.toml

[app]
address = "0.0.0.0:9000"

admin_username = "listmonk"
admin_password = "listmonk"

# Database.
[db]
host = "listmonk_db"
port = 5432
user = "listmonk"
password = "listmonk"
database = "listmonk"

ssl_mode = "disable"
max_open = 25
max_idle = 25
max_lifetime = "300s"

docker-compose.yml

version: "3.7"

x-app-defaults: &app-defaults
  restart: unless-stopped
  image: listmonk/listmonk:latest
  ports:
    - "9003:9000"
  networks:
    - listmonk
  environment:
    - TZ=Etc/UTC
    - SITE_URL=https://listmonk.example.com
x-db-defaults: &db-defaults
  image: postgres:13
  ports:
    - "9432:5432"
  networks:
    - listmonk
  environment:
    - POSTGRES_PASSWORD=listmonk
    - POSTGRES_USER=listmonk
    - POSTGRES_DB=listmonk
  restart: unless-stopped
  healthcheck:
    test: ["CMD-SHELL", "pg_isready -U listmonk"]
    interval: 10s
    timeout: 5s
    retries: 6

services:
  db:
    <<: *db-defaults
    container_name: listmonk_db
    volumes:
      - type: volume
        source: listmonk-data
        target: /var/lib/postgresql/data

  app:
    <<: *app-defaults
    container_name: listmonk_app
    depends_on:
      - db
    volumes:
      - ./config.toml:/listmonk/config.toml

networks:
  listmonk:

volumes:
  listmonk-data:

@MaximilianKohler
Copy link
Contributor

Hmm, I don't have SITE_URL=https://listmonk.example.com. I've never seen that mentioned before. Why did you add that?

@meljoann
Copy link
Author

I found it on here: https://github.com/tiredofit/docker-listmonk and thought it was worth a shot!

@MaximilianKohler
Copy link
Contributor

MaximilianKohler commented Dec 3, 2023

Regarding the OP's question, I just experienced that again and it turned out to be some extra lines in my nginx config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants