Hi everyone
I’m pretty new to Docker and am not sure if I’m even in the right place, so feel free to bat me away if I’ve got the wrong end of the stick.
I’m trying to get a Drupal site working at localhost and it’s redirecting from http://localhost to https://localhost when Docker is running.
When I load localhost in Chrome the output I get from terminal is:
php_1 | 172.29.0.8 - 13/Apr/2021:14:51:24 +0000 "GET /index.php" 301
nginx_1 | 172.29.0.2 - - [13/Apr/2021:14:51:24 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4476.0 Safari/537.36"
So I think the problem is that nginx is redirecting to https. If I’m right how do I turn it off?
My docker-compose.yml is:
version: "2"
services:
mariadb:
image: wodby/mariadb:10.1-2.3.3
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
ports:
- "3307:3306"
volumes:
# - ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
- ./.persist/mysql:/var/lib/mysql:cached # I want to manage volumes manually.
labels:
- "traefik.backend=mariadb"
- "traefik.port=3306"
- "traefik.frontend.rule=Host:localhost"
php:
# 2. Images without Drupal – wodby/drupal-php:[PHP_VERSION]-[STABILITY_TAG].
# image: wodby/drupal-php:7.1-2.4.3
# image: wodby/drupal-php:7.0-2.1.0
# image: wodby/drupal-php:5.6-2.1.0
# image: wodby/drupal-php:5.3-2.1.0
build: ./build/php
environment:
DOCKER_LOCAL: 1
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
DB_HOST: mariadb
DB_USER: drupal
DB_PASSWORD: drupal
DB_NAME: drupal
DB_DRIVER: mysql
PHP_XDEBUG: 1
PHP_XDEBUG_DEFAULT_ENABLE: 1
PHP_XDEBUG_REMOTE_CONNECT_BACK: 0 # This is needed to respect remote.host setting bellow
PHP_XDEBUG_REMOTE_HOST: "10.254.254.254" # You will also need to 'sudo ifconfig lo0 alias 10.254.254.254'
PHP_IDE_CONFIG: "serverName=localhost" # Needed for xdebug for drush commands.
PHP_XDEBUG_REMOTE_AUTOSTART: 0
volumes:
- ./:/var/www/html
- ./.persist/public:/var/www/html/docroot/sites/default/files
- ./.persist/private:/private
nginx:
# wodby/drupal-nginx:[DRUPAL_VERSION]-[NGINX_VERSION]-[STABILITY_TAG].
image: wodby/drupal-nginx:8-1.13-2.4.2
# image: wodby/drupal-nginx:7-1.10-2.1.0
# image: wodby/drupal-nginx:6-1.10-2.1.0
depends_on:
- php
environment:
NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
NGINX_SERVER_ROOT: /var/www/html/docroot
volumes:
- ./:/var/www/html
- ./.persist/public:/var/www/html/docroot/sites/default/files
labels:
- "traefik.backend=nginx"
- "traefik.port=80"
- 'traefik.frontend.rule=HostRegexp:localhost,{subdomain:[a-z0-9-\\.]+}.localhost, {subdomain:[a-z0-9]+}.ngrok.io'
# varnish:
# image: wodby/drupal-varnish:4.1-2.1.0
# depends_on:
# - nginx
# environment:
# VARNISH_SECRET: secret
# VARNISH_BACKEND_HOST: nginx
# VARNISH_BACKEND_PORT: 80
# labels:
# - 'traefik.backend=varnish'
# - 'traefik.port=6081'
# - 'traefik.frontend.rule=Host:varnish.localhost'
redis:
image: wodby/redis:3.2-2.1.0
# pma:
# image: phpmyadmin/phpmyadmin
# environment:
# PMA_HOST: mariadb
# PMA_USER: drupal
# PMA_PASSWORD: drupal
# PHP_UPLOAD_MAX_FILESIZE: 1G
# PHP_MAX_INPUT_VARS: 1G
# labels:
# - 'traefik.backend=pma'
# - 'traefik.port=80'
# - 'traefik.frontend.rule=Host:pma.localhost'
solr:
## wodby/drupal-solr:[DRUPAL_VERSION]-[SOLR_VERSION]-[STABILITY_TAG].
image: wodby/drupal-solr:8-6.4-2.0.0
## image: wodby/drupal-solr:8-6.3-2.0.0
# image: wodby/drupal-solr:8-5.5-2.0.0
## image: wodby/drupal-solr:7-6.4-2.0.0
## image: wodby/drupal-solr:7-6.3-2.0.0
## image: wodby/drupal-solr:7-5.5-2.0.0
environment:
SOLR_HEAP: 1024m
ports:
- "8983:8983"
volumes:
- ./.persist/solr:/opt/solr/server/solr/core1:delegated
labels:
- "traefik.backend=solr"
- "traefik.port=8983"
- "traefik.frontend.rule=Host:solr.local"
mailhog:
image: mailhog/mailhog
labels:
- "traefik.backend=mailhog"
- "traefik.port=8025"
- "traefik.frontend.rule=Host:mailhog.localhost"
# node:
# image: node:7-alpine
# working_dir: /app
# labels:
# - 'traefik.backend=node'
# - 'traefik.port=3000'
# - 'traefik.frontend.rule=Host:front.localhost'
# expose:
# - "3000"
# volumes:
# - ./path/to/your/single-page-app:/app
# command: sh -c 'npm install && npm run start'
# memcached:
# image: wodby/memcached:1.4-2.0.0
traefik:
image: traefik:1.7
command: -c /dev/null --web --docker --logLevel=INFO --defaultEntryPoints='https,http' --entryPoints='Name:https Address::443 TLS:/certs/local.crt,/certs/local.key' --entryPoints='Name:http Address::80'
ports:
- "80:80"
- "443:443"
# - '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./.persist/certs:/certs
Thanks for your time.