Access Frappe apps through custom domains on self hosted

Greetings
Following the custom apps guide, I am deploying erpnext, hrms and helpdesk. I have used the .env file to specify some parameters such as FRAPPE_SITE_NAME_HEADER=erp and HTTP_PUBLISH_PORT=8085

After completing the build, I added restart: unless-stopped to the newly generated compose file, docker-compose.yml.
Then I executed this to run the containers:

  • docker compose --project-name liyumfi -f ./docker-compose.yml up -d

Everything is good so far. I have created the first site while the containers are running using this command:

  • docker compose --project-name liyumfi exec backend bench new-site liyumfi.net --mariadb-root-password 123 --admin-password 123123
    and then installed erpnext on the site I have created
    docker compose -f ./docker-compose.yml --project-name liyumfi exec backend bench --site liyumfi.net install-app erpnext

I added erp.liyumfi.net in /etc/hosts file. Finally when I tried to access the erpnext through the domain (erp.liyumfi.net) I got the following error:

image

I am sure I am missing something here, can someone give me support, please? Thank you

I just created a new site with the same name I used for FRAPPE_SITE_NAME_HEADER and now I can access the system through erp.liyumfi.net which is mapped to 127.0.0.1 in /etc/hosts file. But I really appreciate if someone could suggest me a better way of doing such thing.