Como fazer múltiplos virtualhost no docker com o container php5.6-apache?

0

Estou tentando criar um host virtual no contêiner php5.6-apache , mas quando tento executar o comando a2ensite.

meu arquivo host_1:

<VirtualHost *:80>
  ServerName local.website1.dev
  DocumentRoot /var/www/html/codeigniter_first/public_html/
  Options Indexes FollowSymLinks

  <Directory "/var/www/html/codeigniter_first/public_html/">
    AllowOverride All
    <IfVersion < 2.4>
      Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
  </Directory>

</VirtualHost>

meu arquivo host_2:

<VirtualHost *:80>
  ServerName local.website2.dev
  DocumentRoot /var/www/html/codeigniter_second/public_html/
  Options Indexes FollowSymLinks

  <Directory "/var/www/html/codeigniter_second/public_html/">
    AllowOverride All
    <IfVersion < 2.4>
      Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
      Require all granted
    </IfVersion>
  </Directory>

</VirtualHost>

Meu arquivo do Docker:

ARG PHP_VERSION=7.2-apache
FROM php:${PHP_VERSION}
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo pdo_mysql

COPY vhost.conf /etc/apache2/sites-enabled/vhost.conf
COPY php56.ini /usr/local/etc/php/php.ini

COPY sites/website1.com.conf /etc/apache2/sites-enabled/website1.com.conf
COPY sites/website2.com.conf /etc/apache2/sites-enabled/website2.com.conf

Meu arquivo do compositor do Docker:

version: "2"
services:
########################################################
#### PHP and Apache Config
########################################################
    www:
        build:
            context: ./docker-config/php-apache
            args:
                - PHP_VERSION=5.6-apache
                - XDEBUG_REMOTE_HOST=192.168.1.70
        container_name: rp-app-workspace
        ports:
            - "80:80"
        volumes:
            - "./workdir-apps:/var/www/html/"
            - "./docker-config/php-apache/logs:/var/log/apache2"
            - "./docker-config/php-apache/sites:/etc/apache2/sites-available"
        links:
            - db
            - memcached
        networks:
            - default
########################################################
#### Volume Configuration
########################################################
volumes:
    persistent:

Quando eu construo meu contêiner do Docker, os hosts virtuais não funcionam. quando tento adicionar comandos para executar a2ensite no arquivo do docker, ele mostra o erro ERROR: Site website1.com does not exist! para a compilação

RUN a2ensite website1.com.conf
RUN a2ensite website2.com.conf

Eu também tento alterar a posição de copiar o arquivo na parte superior e executar o comando na parte inferior do arquivo docker.

    
por Abhishek Badole 29.12.2017 / 10:14

0 respostas