I use nginx+letsencrypt as proxy in docker, that's my nginx.yml:
version: "3.7"
services:
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy
restart: always
ports:
- 80:80
- 443:443
networks:
- proxy
volumes:
- /myfolder/nginx/certs:/etc/nginx/certs
- /myfolder/nginx/vhost.d:/etc/nginx/vhost.d
- /myfolder/nginx/conf.d:/etc/nginx/conf.d
- /myfolder/nginx/html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
nginx-proxy-letsencrypt:
container_name: nginx-proxy-letsencrypt
image: jrcs/letsencrypt-nginx-proxy-companion
restart: always
volumes:
- /myfolder/nginx/certs:/etc/nginx/certs
- /myfolder/nginx/vhost.d:/etc/nginx/vhost.d
- /myfolder/nginx/conf.d:/etc/nginx/conf.d
- /myfolder/nginx/html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- NGINX_PROXY_CONTAINER=nginx-proxy
networks:
- proxy
networks:
proxy:
external: true
It works normally with different programs in other containers when I write in configs of that programs:
VIRTUAL_HOST: my.host.com,www.my.host.com
REDIRECT: my.host.com
LETSENCRYPT_HOST: my.host.com
LETSENCRYPT_EMAIL: admin@host.com
But it doesnt work with moodle (because we have apache builted in moodle), that's my moodle.yml:
version: "3.7"
services:
db:
image: 'bitnami/mariadb:10.2'
container_name: db
restart: always
volumes:
- /myfolder/moodle/db_data:/bitnami/mariadb
environment:
MARIADB_ROOT_PASSWORD: MyPassword
MARIADB_USER: admin
MARIADB_PASSWORD: MyPassword
MARIADB_DATABASE: moodledb
networks:
- moodle
moodle:
image: bitnami/moodle:3.11.5
container_name: moodle
restart: always
environment:
- MOODLE_DATABASE_HOST=db
- MOODLE_DATABASE_NAME=moodledb
- MOODLE_DATABASE_USER=admin
- MOODLE_DATABASE_PASSWORD=MyPassword
- MOODLE_USERNAME=admin
- MOODLE_PASSWORD=MyPassword
- MOODLE_EMAIL=admin@host.com
- MOODLE_SITE_NAME=MyMoodle
- VIRTUAL_HOST=lms.host.com,www.lms.host.com
- REDIRECT=lms.host.com
- LETSENCRYPT_HOST=lms.host.com
- LETSENCRYPT_EMAIL=admin@host.com
- MOODLE_HOST=lms.host.com
- MOODLE_REVERSEPROXY=true
- MOODLE_SSLPROXY=true
volumes:
- /myfolder/moodle/data:/bitnami/moodle
- /myfolder/moodle/moodledata:/bitnami/moodledata
build:
context: .
dockerfile: Dockerfile
args:
- EXTRA_LOCALES=ru_RU.UTF-8 UTF-8, ua_UA.UTF-8 UTF-8
depends_on:
- db
networks:
- moodle
- proxy
phpmyadmin:
image: 'phpmyadmin/phpmyadmin'
container_name: moodlepma
restart: always
environment:
PMA_HOST: db
UPLOAD_LIMIT: 1000M
depends_on:
- db
networks:
- moodle
networks:
proxy:
external: true
moodle:
Moodle logs:
moodle 20:22:03.76
moodle 20:22:03.76 Welcome to the Bitnami moodle container
moodle 20:22:03.76 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-moodle
moodle 20:22:03.76 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-moodle/issues
moodle 20:22:03.76
moodle 20:22:03.76 INFO ==> ** Starting Moodle setup **
realpath: /bitnami/apache/conf: No such file or directory
moodle 20:22:03.80 INFO ==> Configuring Apache ServerTokens directive
moodle 20:22:03.83 INFO ==> Configuring PHP options
moodle 20:22:03.84 INFO ==> Setting PHP expose_php option
moodle 20:22:03.86 INFO ==> Validating settings in MYSQL_CLIENT_* env vars
moodle 20:22:03.87 INFO ==> Validating settings in POSTGRESQL_CLIENT_* env vars
moodle 20:22:03.97 INFO ==> Restoring persisted Moodle installation
moodle 20:22:04.98 INFO ==> Trying to connect to the database server
moodle 20:22:05.01 INFO ==> Running database upgrade
moodle 20:22:05.29 INFO ==> ** Moodle setup finished! **
moodle 20:22:05.30 INFO ==> ** Starting cron **
moodle 20:22:05.32 INFO ==> ** Starting Apache **
[Sat Apr 09 20:22:05.363075 2022] [ssl:warn] [pid 1] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Sat Apr 09 20:22:05.363392 2022] [ssl:warn] [pid 1] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Apr 09 20:22:05.381122 2022] [ssl:warn] [pid 1] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Sat Apr 09 20:22:05.381382 2022] [ssl:warn] [pid 1] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Apr 09 20:22:05.389028 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.52 (Unix) OpenSSL/1.1.1d configured -- resuming normal operations
[Sat Apr 09 20:22:05.389060 2022] [core:notice] [pid 1] AH00094: Command line: '/opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf -D FOREGROUND'
I never used nginx before. Maybe trouble somewhere in apache configs. Can anyone help me with it? :(