lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.92k stars 269 forks source link

Can't access status web server outside of VM #555

Closed zhyph closed 1 year ago

zhyph commented 1 year ago

Hello,

I'm trying to use status web server as a way to make my life easier, and just check in my browser if the connection of my server is ok without the need to SSH into the server and checking manually.

Running curl localhost:80/status.json inside my VM works just fine. But trying to fetch it outside, though my external link, just doesn't work.

This is my docker compose

version: "3"

services: 
  valheim: 
    image: ghcr.io/lloesche/valheim-server
    cap_add:
      - sys_nice
    volumes: 
      - $HOME/valheim-server/config:/config
      - $HOME/valheim-server/data:/opt/valheim
    ports: 
      - "2456-2457:2456-2457/udp"
      - "9001:9001/tcp"
      - "80:80/tcp"
    env_file:
      - $HOME/valheim-server/valheim.env
    restart: always
    stop_grace_period: 2m

This is my env file

SERVER_NAME=server
WORLD_NAME=MyWorld
SERVER_PASS=password
SERVER_PUBLIC=true
VALHEIM_PLUS=true
STATUS_HTTP=true

In my cloud service port 80/tcp is already forwarded, what exactly I'm missing?

wcdanh2 commented 1 year ago

You might want to try setting STATUS_HTTP_PORT to a port other than 80 (dont forget to add that port to the docker compose, and port forward). If you can then fetch the status from outside there is probably some default service on your vm that is running on port 80.

zhyph commented 1 year ago

You might want to try setting STATUS_HTTP_PORT to a port other than 80 (dont forget to add that port to the docker compose, and port forward). If you can then fetch the status from outside there is probably some default service on your vm that is running on port 80.

Oh, that actually makes sense because the firewall by default forwards port 80. Later today, I'm going to give it a try, and I'll report back. Thanks.

zhyph commented 1 year ago

Just tested, and it's working, changed port to 3000, and now I can get /status.json. Thanks @wcdanh2