Please show me how I deploy a custom configured NGinX server with nix packages in Dokploy
Please show me how I deploy a custom configured NGinX server with nix packages in Dokploy
26 Replies
create a docker compose application, then select
raw
go to advanced -> volumes -> create new
content:
mount path: ./nginx.conf
then go to the browser and do: server-ip:8081 and you will see this
Thank you so much @Siumauricio !
It seems to work, although when browsing in the browser to this Docker compose service it says “404 page not found”
what do you mean?
how you are accessing to the nginx?
It looks like the issue lies with Environment variables not being picked up. For example through the Dokploy user interface I have set an environment variable “ APP_PORT=8081”, whereas the log of my deployment states “… msg=“The ”APP_PORT” variable is not set. Defaulting to a blank string.”
I am on Dokploy version 0.2.4
hmm are you using the env variable inside the compose file?
Yes, like so:
labels:
- “traefik.http.services.${HASH}.loadbalancer.server.port=${APP_PORT}”
got it, and the hash are you using what is the value?
For the hash I use a ‘unique’ name, in this case HASH=app
could you try to use like this?
this is a example from pocketbase template
enviroment variables:
POCKETBASE_HOST=testing-pocketbase-fabbe4-179-49-119-201.traefik.me
POCKETBASE_PORT=80
HASH=testing-pocketbase-5cbe9a
Host(‘${APP_HOST}’) with backticks
yeah
Can it pick up the Environment variables set through the web user interface of Dokploy?
What do you mean?
dokploy will automatically inject the environment variables into your docker compose file.
so you don't have to do anything
Where do you store these environment variables? In Dokploy environments tab, or in a .env file in a GitHub repository?
dokploy enviroments tab
take a look about pocketbase template


OK, then I don’t understand why the log says it is not set?
try to reload traefik
Please tell me how to reload traefik, thank you!
Settings -> scroll down traefik -> reload
Thanks, it says error to reload traefik
Check logs
I don’t see errors in logs
Would a clean help?
Thank you @Siumauricio your answer is fantastic and detailed! All works well, but when I try to check from a browser with server IP and port 8081 I get a warning “This site can’t be reached” instead of what you posted here. What is your advice, please.
@wvanheemstra can you please show the docker compose file?
services:
nginx:
image: nginx:latest
ports:
- "${APP_PORT}:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
networks:
- dokploy-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.${HASH}.rule=Host(
${APP_HOST}
)"
- "traefik.http.routers.${HASH}.entrypoints=websecure"
- "traefik.http.routers.${HASH}.tls.certResolver=letsencrypt"
- "traefik.http.services.${HASH}.loadbalancer.server.port=${APP_PORT}"
whoami:
image: traefik/whoami
ports:
- "80"
networks:
- dokploy-network
networks:
dokploy-network:
external: true