# Server Installation on a different port

**URL:** <https://hub.mender.io/t/server-installation-on-a-different-port/6096>\
**Category:** General Discussions\
**Created:** [August 8, 2023, 1:27pm UTC](https://hub.mender.io/t/server-installation-on-a-different-port/6096 "2023-08-08T13:27:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dekan](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dekan](https://hub.mender.io/u/dekan)\
**Post date:** [August 8, 2023, 1:27pm UTC](https://hub.mender.io/t/server-installation-on-a-different-port/6096/1 "2023-08-08T13:27:26Z")

</div>

Hello everbody

I need to publish the Mender server using the port 44344 because there is a traefik for my already existing services on the port 443. I thought that I can make use of traefik behind traefik as shown below:

 ![tbt](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/e/e7e8cbe4571deae21365c6b22a86e32e4d61cd60.jpeg)

The steps that I have already followed so far are the following:

1. I have changed mender-api-gateway service in prod.yml file inside the directory production/config such that it is now as follows:  
…  
ports:  
“44344:443”  
network:  
mender  
traefik-public  
…  
…  
environment:  
ALLOWED\_HOSTS: [my-domain.com:44344](http://my-domain.com:44344)

Note: treafik-public is the network of the services that are routed by my already existing traefik on port 443.

1. I have changed the mender-api-gateway service inside docker-compose.yml file, and it is now as follows:

…  
…  
networks:

- mender
- traefik-public  
…  
…  
labels:  
- “traefik.enable=true”  
- “traefik.http.routers.mender-api-gateway.rule=Host(`my-domain.com`)”  
- “traefik.http.services.mender-api.gateway.loadbalancer.server.port=443”  
- “traefik.http.routers.mender-api-gateway.entrypoints=websecure”  
- “treafik.http.routers.mender-api-gateway.tls=true”  
- “traefik.http.routers.mender-api.gateway.tls.certresolver=leresolver”  
- “treafik.docker.network=traefik-public”  
…  
…  
…  
…  
networks:  
mender:  
traefik-public:  
external: true

The things that I have done so far is not sufficient to make the server work. The other things that I have tried with this configuration is that I have both written the port 44344 at the end of the allowed host domain, and not written it. Both cases did not work.

When I go to the the [my-domain.com](http://my-domain.com), it says the page is not working.When I go to the [my-domain.com:44344](http://my-domain.com:44344) , it says connection is not secure, and I cannot go further from there.

Has anyone accomplished that?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![alfrunes](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/alfrunes/32/703_2.png) [@alfrunes](https://hub.mender.io/u/alfrunes)\
**Post date:** [August 9, 2023, 7:45am UTC](https://hub.mender.io/t/server-installation-on-a-different-port/6096/2 "2023-08-09T07:45:13Z")

</div>

Hi @dekan 👋

> When I go to the the [my-domain.com](http://my-domain.com/), it says the page is not working.When I go to the [my-domain.com:44344](http://my-domain.com:44344/) , it says connection is not secure, and I cannot go further from there.

It looks like either the certificate for the Mender Traefik instance is not covering `my-domain.com` or you’re using a self-signed certificate. You need to provide a trusted certificate to the mender traefik instance as well (check the volume mounts for `/etc/traefik/certs/cert.crt` in the `mender-api-gateway` service). If the entire mender deployment (including the gateway) inside a secure private network, would it be an alternative to disable TLS?

For the public gateway, if you’re setting up a route based on a path prefix, you need to [create a middleware](https://doc.traefik.io/traefik/middlewares/http/stripprefix/) that strips this path prefix when it’s forwarded to the Mender Traefik instance.

---

<div class="post-metadata">

**Author:** ![dekan](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dekan](https://hub.mender.io/u/dekan)\
**Post date:** [August 16, 2023, 8:44am UTC](https://hub.mender.io/t/server-installation-on-a-different-port/6096/3 "2023-08-16T08:44:52Z")

</div>

Thank you.  
I checked the volume mounts, it looks correct.But, now I am getting Bad Gateway when I go to the [domain.com](http://domain.com). What could be the reason when you consider my case ?
