5
My web development container uses the image php:7.1-apache. To make it easier to memorize the address of the applications contained in this container, I like to edit my machine’s Hosts file and make the note this way:
127.0.0.1 site.dev
However, recently I have had difficulties with this approach, it seems that browsers have recently forced HTTPS, that is, I am redirected and consequently I fall into an error page of the browser itself since SSL is not configured in the apache server that runs in the container.
Any solution for this, other than setting up SSL?
The host system that runs the container is a Mac OS (last stable version)
Follow the data to assemble the container:
Docker-Compose.yaml
version: "3.3"
services:
mysql:
container_name: mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: senha_root
MYSQL_DATABASE: banco
MYSQL_USER: root
MYSQL_PASSWORD: senha_user
command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
volumes:
- ./mysql/tmp:/var/lib/mysql
restart: on-failure
ports:
- 3306:3306
web:
container_name: web
image: web_dev
build:
context: .
dockerfile: Dockerfile-web
volumes:
- ./projetos/:/var/www
- ./apache/:/etc/apache2/sites-enabled/
working_dir: /var/www
depends_on:
- mysql
links:
- mysql
restart: on-failure #always
ports:
- 80:80
- 3000:3000
- 3001:3001
Dockerfile
FROM php:7.1-apache
MAINTAINER Fabio J L Ferreira <[email protected]>
RUN apt-get update; \
a2enmod rewrite; \
apt-get install -y curl unzip git npm libpng-dev; \
curl -sL https://deb.nodesource.com/setup_8.x | bash -; \
apt-get install -y nodejs; \
echo "America/Sao_Paulo" > /etc/timezone; \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
# Install PHP "gd" extension
# RUN apt-get install -y libjpeg-dev libpng12-dev
# RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ && docker-php-ext-install gd
# Instala a extensão PHP "exif" => http://php.net/manual/en/intro.exif.php
# RUN apt-get install -y libexif-dev && RUN docker-php-ext-install exif
# Extensão "mysqi" e algumas "PDO" => http://php.net/manual/en/book.pdo.php
RUN apt-get install -y libpq-dev; \
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql; \
docker-php-ext-install mysqli pdo_mysql pgsql pdo_pgsql
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
COPY php/php.ini /usr/local/etc/php/
@Bacco yes in the link I posted says the same as you even, it was my mistake, but you know how it is zillions of people can teach and do wrong that it’s okay :) (sorry man, there is something that is sincerely difficult -.-) ... ps: I promise to review and correct the answer :)
– Guilherme Nascimento