diff --git a/LICENSE b/LICENSE index 55d904dcee..bf87255082 100644 --- a/LICENSE +++ b/LICENSE @@ -2,6 +2,7 @@ MIT License Copyright (c) 2017 Narendra Vaghela Copyright (c) 2019 Malte Graebner aka (MrOffline77) +Copyright (c) 2024 Nishant Vaity aka (enishant) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bin/php54/Dockerfile b/bin/php54/Dockerfile index 40c709e431..8270e9c439 100644 --- a/bin/php54/Dockerfile +++ b/bin/php54/Dockerfile @@ -43,6 +43,9 @@ RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-di RUN pecl install xdebug-2.4.0RC4 && docker-php-ext-enable xdebug \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php56/Dockerfile b/bin/php56/Dockerfile index 3afa7d1245..48ebc3ea90 100644 --- a/bin/php56/Dockerfile +++ b/bin/php56/Dockerfile @@ -39,6 +39,9 @@ RUN docker-php-ext-install curl \ && pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug \ && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php71/Dockerfile b/bin/php71/Dockerfile index 27787956fa..04b205bc9f 100644 --- a/bin/php71/Dockerfile +++ b/bin/php71/Dockerfile @@ -43,6 +43,9 @@ RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ RUN docker-php-ext-install -j$(nproc) gd +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php72/Dockerfile b/bin/php72/Dockerfile index f6edeac270..42b886ee01 100644 --- a/bin/php72/Dockerfile +++ b/bin/php72/Dockerfile @@ -53,6 +53,9 @@ RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ RUN docker-php-ext-install -j$(nproc) gd +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php73/Dockerfile b/bin/php73/Dockerfile index 32228b9aa5..eac2aa7589 100644 --- a/bin/php73/Dockerfile +++ b/bin/php73/Dockerfile @@ -60,6 +60,9 @@ RUN apt-get -y update && \ # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Enable SSL support RUN a2enmod ssl && a2enmod rewrite diff --git a/bin/php74/Dockerfile b/bin/php74/Dockerfile index f8b7d99e8b..8d4021d4dc 100644 --- a/bin/php74/Dockerfile +++ b/bin/php74/Dockerfile @@ -77,6 +77,9 @@ libpng-dev && \ docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ docker-php-ext-install gd +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php8/Dockerfile b/bin/php8/Dockerfile index fc76afb609..7e954839ec 100644 --- a/bin/php8/Dockerfile +++ b/bin/php8/Dockerfile @@ -91,6 +91,9 @@ libpng-dev && \ docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ docker-php-ext-install gd +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php81/Dockerfile b/bin/php81/Dockerfile index aa7f3508ff..d56c669dda 100644 --- a/bin/php81/Dockerfile +++ b/bin/php81/Dockerfile @@ -90,6 +90,9 @@ libpng-dev && \ docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ docker-php-ext-install gd +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/bin/php82/Dockerfile b/bin/php82/Dockerfile index d14be2de3b..d562bba9ba 100644 --- a/bin/php82/Dockerfile +++ b/bin/php82/Dockerfile @@ -90,6 +90,9 @@ libpng-dev && \ docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg && \ docker-php-ext-install gd +# Insure VHOSTS directory exists +RUN mkdir -p /var/www/vhosts + # Insure an SSL directory exists RUN mkdir -p /etc/apache2/ssl diff --git a/config/vhosts/default.conf b/config/vhosts/default.conf index 12f1cc78a1..df8b9b74a1 100644 --- a/config/vhosts/default.conf +++ b/config/vhosts/default.conf @@ -7,6 +7,29 @@ + + ServerAdmin webmaster@example.com + DocumentRoot ${APACHE_VHOSTS_DOCUMENT_ROOT}/example.com + ServerName example.com + ServerAlias www.example.com + + AllowOverride all + + + + + ServerAdmin webmaster@secure.example.com + DocumentRoot ${APACHE_VHOSTS_DOCUMENT_ROOT}/secure.example.com + ServerName secure.example.com + + AllowOverride all + + + SSLEngine on + SSLCertificateFile /etc/apache2/ssl/secure.example.com-cert.pem + SSLCertificateKeyFile /etc/apache2/ssl/secure.example.com-cert-key.pem + + # Allows HTTPS on localhost. You will need to use mkcert on your local machine # to create the `cert.pem` and `cert-key.pem` files, and then place them in the # `./config/ssl` directory. You could also create certificates for any local diff --git a/docker-compose.yml b/docker-compose.yml index 4cb90d0d16..58e2cebcca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,7 @@ services: - database volumes: - ${DOCUMENT_ROOT-./www}:/var/www/html:rw + - ${VHOSTS_DOCUMENT_ROOT-./vhosts}:/var/www/vhosts:rw - ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini - ${SSL_DIR-./config/ssl}:/etc/apache2/ssl/ - ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled @@ -20,6 +21,7 @@ services: - ${XDEBUG_LOG_DIR-./logs/xdebug}:/var/log/xdebug environment: APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT-/var/www/html} + APACHE_VHOSTS_DOCUMENT_ROOT: ${APACHE_VHOSTS_DOCUMENT_ROOT-/var/www/vhosts} PMA_PORT: ${HOST_MACHINE_PMA_PORT} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_USER: ${MYSQL_USER} diff --git a/sample.env b/sample.env index a1ee15aa40..4ce9e8c7e7 100644 --- a/sample.env +++ b/sample.env @@ -7,7 +7,9 @@ COMPOSE_PROJECT_NAME=lamp # Possible values: php54, php56, php71, php72, php73, php74, php8, php81, php82 PHPVERSION=php8 DOCUMENT_ROOT=./www +VHOSTS_DOCUMENT_ROOT=./vhosts APACHE_DOCUMENT_ROOT=/var/www/html +APACHE_VHOSTS_DOCUMENT_ROOT=/var/www/vhosts VHOSTS_DIR=./config/vhosts APACHE_LOG_DIR=./logs/apache2 PHP_INI=./config/php/php.ini diff --git a/vhosts/example.com/.gitkeep b/vhosts/example.com/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vhosts/secure.example.com/.gitkeep b/vhosts/secure.example.com/.gitkeep new file mode 100644 index 0000000000..e69de29bb2