HomarrH
Homarr10mo ago
8 replies
Floyddo

Run on different port

I'm running Homarr in Docker using ipvlan networking, which prevents me from using the standard port mapping functionality (like
-p 80:7575
).

I want to change the default port that Homarr runs on internally from 7575 to 80, as my network configuration doesn't allow port mapping. I've tried setting
DOCKER_PORTS=80
as an environment variable, but this doesn't change Homarr's listening port (it only affects Docker API connectivity) [according to the ai].

Is there any way to configure Homarr to listen on a different port than the default 7575? Perhaps through an environment variable or configuration file that isn't mentioned in the documentation? Or am I not using an obvious docker feature?

checked another question,
PORT 
env did not work either

Port 7575 seems hardcoded
I have a goal of reaching my dashboard via dashboard.mydomain.com from within my LAN. Using portainer, I've configured and created a macvlan and updated the Homarr stack to use that network. The container is now happily running on its own reserved IP at 192.168.1.160 and I'm able to reach the dashboard at http://homarr.mydomain.com:7575.

The n...
Mapping port 80:7575 - Homarr
Solution
We can set the port by overriding the NGINX config at
/etc/nginx/templates/nginx.conf
with a bind volume like below (docker compose).
    volumes:
      - ./HOMARRNGINX.conf:/etc/nginx/templates/nginx.conf
    networks:
      lan: # your ipvlan or macvlan network


./HOMARRNGINX.conf
: (just change the port from this file, keep in mind this will not upgrade this file with updates at it will just keep overriding it!)
events {
    worker_connections 1024;
}

http {
    server {
        listen YOURPORTHERE;

        # Route websockets traffic to port 3001
        location /websockets {
            proxy_pass http://${HOSTNAME}:3001;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $http_host;
        }

        # Route all other traffic to port 3000
        location / {
            proxy_pass http://${HOSTNAME}:3000;
            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;
            proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
        }
    }
}
Was this page helpful?