Hi, I have built a container with a Dockerfile from php:5.5.35-apache. I wonder where I have to place my apache2 conf Files with aliases, DocumentRoot and so on.
When I copy my conf to /etc/apache2/sites-enabled/ the container fails to start.
ciao
chris
@cwrm Have you found a solution to this problem?
I'm having the exact same issue and found no correct solution.
Here are a few of my failed attempts:
Can you share your Apache and docker-compose files? Perhaps you have a custom log directive pointing outside the APACHE_LOG_DIR?
version: '2'
services:
web:
image: eyalshalev/php:apache
ports:
- "80:80"
volumes:
- "./docroot:/var/www/html"
- "./apache2/vhosts:/etc/apache2/from-host"
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: sandbox
pma:
image: phpmyadmin/phpmyadmin
ports:
- "8009:8009"
composer:
image: composer/composer
volumes_from:
- web
working_dir: /var/www/html
FROM php:7.0-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
RUN mkdir -p /etc/apache2/from-host
RUN echo "" >> /etc/apache2/apache2.conf \
&& echo "# Include the configurations from the host machine" >> /etc/apache2/apache2.conf \
&& echo "IncludeOptional from-host/*.conf" >> /etc/apache2/apache2.conf
Not sure what you mean by an Apache file?
I think that the problem might be from the conf file I'm trying to add:
<VirtualHost docker-machine:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory /var/www/html>
AllowOverride All
AccessFileName .htaccess
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
@yosifkit @cwrm Sorry that I've bothered you, the problem was with my configuration files.
I managed to find and fix it using the docker-compose logs command.
This appears to be solved (so I'm going to close)! /etc/apache2/sites-enabled/ is definitely an appropriate place to copy this sort of configuration, just as in a stock Debian Apache installation. :+1:
Most helpful comment
@yosifkit @cwrm Sorry that I've bothered you, the problem was with my configuration files.
I managed to find and fix it using the
docker-compose logscommand.