A website developed for the Web Development module using the docker-compose-lamp repository.
A LAMP stack environment built using Docker Compose, with the following dependencies:
- PHP
- Apache
- MySQL
- phpMyAdmin
- Redis
- Clone this repository on your local computer
- Configure
.envas needed - Run
docker compose up -d
git clone https://github.com/YOUR_USERNAME/Web-Development-CW.git
cd Web-Development-CW/
cp sample.env .env
# modify .env as needed
docker compose up -d
# visit localhostYour LAMP stack is now ready. You can access it via http://localhost.
This package comes with default configuration options. You can modify them by creating a .env file in your root directory.
To make it easy, just copy the content from sample.env and update the environment variable values as per your need.
PHPVERSION Is used to specify which PHP version you want to use. Defaults to the latest PHP version.
PHP_INI
Define your custom php.ini modifications to meet your requirements.
DOCUMENT_ROOT
Document root for the Apache server. The default value is ./www. All your sites will go here and will be synced automatically.
APACHE_DOCUMENT_ROOT
Apache config file value. The default value is /var/www/html.
VHOSTS_DIR
For virtual hosts. The default value is ./config/vhosts. You can place your virtual hosts conf files here.
Make sure you add an entry to your system's
hostsfile for each virtual host.
APACHE_LOG_DIR
Used to store Apache logs. The default value is ./logs/apache2.
For Apple Silicon users: please select MariaDB as the database. Oracle doesn't build MySQL containers for the ARM architecture.
DATABASE Define which MySQL or MariaDB version you would like to use.
MYSQL_INITDB_DIR
When a container is started for the first time, files in this directory with the extensions .sh, .sql, .sql.gz and .sql.xz will be executed in alphabetical order. The default value is ./config/initdb.
MYSQL_DATA_DIR
MySQL data directory. The default value is ./data/mysql.
MYSQL_LOG_DIR
Used to store MySQL logs. The default value is ./logs/mysql.
MYSQL_CNF
Define your custom my.cnf modifications to meet your database requirements.
Note: When providing a host value to your application, use database instead of localhost.
Apache is configured to run on port 80, accessible via http://localhost.
By default the following modules are enabled:
- rewrite
- headers
You can connect to the web server using docker compose exec to perform various operations on it.
docker compose exec webserver bashThe installed version of PHP depends on your .env file.
By default the following extensions are installed (may differ for PHP versions below 7.x):
- mysqli
- pdo_sqlite
- pdo_mysql
- mbstring
- zip
- intl
- mcrypt
- curl
- json
- iconv
- xml
- xmlrpc
- gd
phpMyAdmin is configured to run on port 8080. Use the following default credentials:
http://localhost:8080/
username: root
password: tiger
Redis runs on the default port 6379.