getting 500 error nginx over https | Docker - docker

Trying to learn and understand the docker and how it works. I am trying to deploy and run an application on the docker container. Everything seems to be working as expected.
Nginx server is up and running.
Redis server is also up and running.
DB service seems to be working as expected.
However I am trying to enable the HTTPS on the application and as per the instructions, I am suppose to provide few details on the server environment for SSL setup which includes
environment:
- VIRTUAL_HOST=mydomain.com
- LETSENCRYPT_HOST=mydomain.com
- LETSENCRYPT_EMAIL=xxx
When I am accessing the application dummy page (an HTML) it seems to be working as expected and I am able to open the page, however when trying to access the same page over https, I am getting 500 error. I tried to see the log file under /var folder but don't see any error in the file.
tailing the container for the logs showing me only this line:
nginx.1 | test.xxx.com xxx.x.xxx.xxx - - [10/Dec/2022:06:05:20 +0000] "GET /favicon.ico HTTP/2.0" 500 177 "https://test.xxx.com/dummy-html.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Firefox/102.0"
I don't see any other details. Here is my docker-compose.yaml file
version: '2'
x-logging:
&default-logging
logging:
driver: json-file
options:
max-size: 100m
services:
nginx:
image: jdj/latest
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./srv/nginx/vhost.d:/etc/nginx/vhost.d
- ./srv/nginx/html:/usr/share/nginx/html
- ./srv/ssl_certs:/etc/nginx/certs:ro
ports:
- "80:80"
- "443:443"
<<: *default-logging
restart: always
letsencrypt:
image: jdj/jrcs-letsencrypt-nginx-proxy-companion:2.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./srv/ssl_certs:/etc/nginx/certs:rw
volumes_from:
- nginx
<<: *default-logging
restart: always
server:
image: jdj/jdj:1.13.0
environment:
- VIRTUAL_HOST=mydomain.com
- LETSENCRYPT_HOST=mydomain.com
- LETSENCRYPT_EMAIL=xxx
volumes:
- ./jdj.conf:/jdj.conf:ro
privileged: true
<<: *default-logging
restart: always
workers:
image: jdj/jdj:1.13.0
command: ["./scripts/workers"]
volumes:
- ./jdj.conf:/jdj.conf:ro
privileged: true
<<: *default-logging
restart: always
db:
image: postgres:13.0
env_file: jdj.conf
volumes:
- postgres-data:/var/lib/postgresql/data/
<<: *default-logging
restart: always
redis:
image: redis:6.0
command: [
"bash", "-c",
'docker-entrypoint.sh --appendonly yes --requirepass "$$REDIS_PASSWORD"'
]
env_file: jdj.conf
volumes:
- redis-data:/data
<<: *default-logging
restart: always
volumes:
postgres-data:
redis-data:
I am not sure what is the issue or is there a way I can see the details on error?

Related

How run minio on docker-compose + nginx reverse proxy?

I have problem with minio, not started on selected domain - 502 error.
my docker-compose.yml for nginx proxy reverse + le
services:
nginx:
container_name: nginx
image: nginxproxy/nginx-proxy
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /var/docker/nginx/html:/usr/share/nginx/html
- /var/docker/nginx/certs:/etc/nginx/certs
- /var/docker/nginx/vhost:/etc/nginx/vhost.d
logging:
options:
max-size: "10m"
max-file: "3"
letsencrypt-companion:
container_name: nginx-le
image: jrcs/letsencrypt-nginx-proxy-companion
restart: unless-stopped
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/docker/nginx/acme:/etc/acme.sh
environment:
DEFAULT_EMAIL: mail#mail.com
docker-compose.yml for minio
version: '2'
services:
minio:
container_name: minio.domain.com
command: server /data --console-address ":9001"
environment:
- MINIO_ROOT_USER=admin
- MINIO_ROOT_PASSWORD=supersecret
- MINIO_BROWSER_REDIRECT_URL=https://minio.domain.com
- MINIO_DOMAIN=minio.domain.com
image: quay.io/minio/minio:latest
volumes:
- minio:/data
restart: unless-stopped
expose:
- "9000"
- "9001"
environment:
VIRTUAL_HOST: minio.domain.com
LETSENCRYPT_HOST: minio.domain.com
networks:
- proxy
networks:
proxy:
external:
name: nginx_default
volumes:
minio:
logs from docker logs for minio container
Warning: Default parity set to 0. This can lead to data loss.
WARNING: Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables
MinIO Object Storage Server
Copyright: 2015-2022 MinIO, Inc.
License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
Version: RELEASE.2022-12-12T19-27-27Z (go1.19.4 linux/amd64)
Status: 1 Online, 0 Offline.
API: http://192.168.0.7:9000 http://127.0.0.1:9000
Console: http://192.168.0.7:9001 http://127.0.0.1:9001
Documentation: https://min.io/docs/minio/linux/index.html
When I put in docker-compose for minio:
ports:
- '9000:9000'
- '9001:9001'
Minio working, but for all domain on my server.
How I can fix that minio show only on minio.domain.com ?

ngrok with docker & nginx. failed to complete tunnel connection

So if I run ngrok outside of docker, the tunnel connects fine. However when I add it to my docker-compose up i get
failed to complete tunnel connection
Here is my docker-compose:
services:
local.box:
image: nginx:1.21
ports:
- "8888:80"
volumes:
- .:/app
ngrok:
image: ngrok/ngrok:alpine
depends_on:
- local.box
environment:
- NGROK_AUTHTOKEN=<my_token>
command: "http local.box:8888"
volumes:
- .:/app
networks:
default:
name: dev-dev
external: true
I have tried host header rewrites, as well as editing my nginx.conf to not use default server.
The nginx stuff starts up just fine as well.
Try to use this command to image ngrox:
services:
local.box:
image: nginx:1.21
ports:
- "8888:80"
volumes:
- .:/app
ngrok:
image: ngrok:alpine
depends_on:
- local.box
environment:
- NGROK_AUTHTOKEN=<my_token>
command: "http local.box:8888"
volumes:
- .:/app
networks:
default:
name: dev-dev
external: true

How can I call from my frontend docker nginx to my backend in nodeJs docker with docker swarmn

I have 3 containers that I communicate with docker swarm, if I run my application with http and connect as http //domain.com everything works fine, but if I use https ( //www.domain.com) I can't communicate my frontend with the backend and I get the following error:
Ajax.js: 10 POST https //www.domain.com/Init net :: ERR_NAME_NOT_RESOLVED
can someone help me solve my problem
and understand the mistake
Thank you
I leave my compose
version: '3'
services:
ssl:
image: danieldent/nginx-ssl-proxy
restart: always
environment:
UPSTREAM: myApp:8086
SERVERNAME: dominio.com
ports:
- 80:80/tcp
- 443:443/tcp
depends_on:
- myApp
volumes:
- ./nginxAPP:/etc/letsencrypt
- ./nginxAPP:/etc/nginx/user.conf.d:ro
bdd:
restart: always
image: postgres:12
ports:
- 5432:5432/tcp
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: 12345
POSTGRES_DB: miBDD
volumes:
- ./pgdata:/var/lib/postgresql/data
pgadmin:
image: dpage/pgadmin4
ports:
- 9095:80/tcp
environment:
PGADMIN_DEFAULT_EMAIL: user
PGADMIN_DEFAULT_PASSWORD: 12345
PROXY_X_FOR_COUNT: 3
PROXY_X_PROTO_COUNT: 3
PROXY_X_HOST_COUNT: 3
PROXY_X_PORT_COUNT: 3
volumes:
- ./pgadminAplicattion:/var/lib/pgadmin
myApp:
restart: always
image: appImage
ports:
- 8086:8086
depends_on:
- bdd
working_dir: /usr/myApp
environment:
CONFIG_PATH: ../configuation
command: "node server.js"

Why I get 404 when I using ecs-cli?

I'm using ecs-cli to deploy my docker-compose.yml to ecs with SSL support.
When I run the command it's show me that the container is running. but when I browse to url is show me 404 error.
why?
this is my docker-compose.yml:
version: '2'
services:
tester-cluster:
image: yeasy/simple-web:latest
environment:
VIRTUAL_HOST: mydomin.net
LETSENCRYPT_HOST: mydomin.net
LETSENCRYPT_EMAIL: mydomin#gmail.com
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- '80:80'
- '443:443'
volumes:
- '/etc/nginx/vhost.d'
- '/usr/share/nginx/html'
- '/var/run/docker.sock:/tmp/docker.sock:ro'
- '/etc/nginx/certs'
letsencrypt-nginx-proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
volumes_from:
- 'nginx-proxy'
You will have to set the WORDPRESS_DB_HOST for the wordpress server as well. This will be something similar to the following:
WORDPRESS_DB_HOST: mysql:3306
Note the host name would be the name of the db container.
You can view container logs by running the following:
docker-compose logs -f -t

Handling server redirection with traefik

I have a http server running in a docker. Accessing the server at / redirects it to /web. This works fine locally. I have setup traefik to connect to the docker through xxxxxxx.com domain. However, this results in a 404 page not found but when I try xxxxxxxx.com/web it works. How does traefik handle this kind of redirects? Thanks in advance.
Here's my docker-compose.yml file:
version: "3"
networks:
proxy:
external: true
internal:
external: false
services:
web:
restart: always
image: odoo:10.0
labels:
- traefik.backend=web
- traefik.frontend.rule=Host:portal.sironirestaurant.com
- traefik.docker.network=proxy
- traefik.port=8069
networks:
- internal
- proxy
depends_on:
- db
ports:
- 8069:8069
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
db:
restart: always
image: postgres:9.4
networks:
- internal
labels:
- traefik.enable=false
environment:
- POSTGRES_PASSWORD=xxxxxxx
- POSTGRES_USER=xxxxxx
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo-db-data:/var/lib/postgresql/data/pgdata
volumes:
odoo-web-data:
odoo-db-data:

Resources