Hello !
I need to access my subdomains from anywhere, and for that I will want to use nginx on my Truenas Scale.
I don't feel like modifying the /etc/nginx/nginx.conf file (never a good idea), so I would like to be able to run a docker-compose that starts nginx and my apps, with nginx redirecting eg portainer. mydomain.com on port 9000 of my nas.
docker-compose.yml :
nginx.conf :
I don't know if my code is good since I couldn't test it, but I run into a first problem, my docker's nginx cannot listen to ports 80 and 443 because they are already listening by the nginx server of the Truenas Scale.
How could I fix that? Am I doing this the right way?
Thank in advance for your answers
I need to access my subdomains from anywhere, and for that I will want to use nginx on my Truenas Scale.
I don't feel like modifying the /etc/nginx/nginx.conf file (never a good idea), so I would like to be able to run a docker-compose that starts nginx and my apps, with nginx redirecting eg portainer. mydomain.com on port 9000 of my nas.
docker-compose.yml :
Code:
version: '3'
services:
nginx:
image: nginx:latest
container_name: nginx
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
ports:
- 80:80
- 443:443
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
volumes:
- /var/run/docker.sock:/var/run/docker.sock
expose:
- 9000nginx.conf :
Code:
http {
server {
server_name portainer.mydomain.com;
location / {
proxy_pass http://127.0.0.0:9000;
}
}
}I don't know if my code is good since I couldn't test it, but I run into a first problem, my docker's nginx cannot listen to ports 80 and 443 because they are already listening by the nginx server of the Truenas Scale.
Code:
ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx address already in use ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (7141e7ea5dd21dc84df75c0e60a41408fc747ee45cf718cb0c07aa2530464697): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use
How could I fix that? Am I doing this the right way?
Thank in advance for your answers