UBUNTU Apache2 PHP server with url-rewritng and reverse-proxy support
856
This image provides an UBUNTU Apache2 PHP server with url-rewritng and reverse-proxy support.
It has a built in option to generate SSL certificates with letsencrypt.
The server works by default on ports 80/443, and able to handle multiple domains in the vhosts.conf file.
Assuming that your user has the docker privileges, here is an example for creating and running the container:
docker run -i -t \
-p 80:80 \
-p 443:443 \
-v /path/to/your/WWW/folder:/home/administrator/WWW \
-e SUDO_PASSWD=my_admin_user_password \
--name MyPhpContainer mbinunn/ubuntu_apache2_php_server
If you have multiple domains or multiple websites in your WWW folder, and you want to implement your own vhosts.conf file, then use:
docker run -i -t \
-p 80:80 \
-p 443:443 \
-v /path/to/your/WWW/folder:/home/administrator/WWW \
-v /path/to/your/vhosts.conf:/etc/apache2/sites-available/000-default.conf \
-e SUDO_PASSWD=my_admin_user_password \
--name MyPhpContainer mbinunn/ubuntu_apache2_php_server
NOTE:
The above command will start the container in the interactive mode, so that you'll see the apache server response.
If you want to run the server in detached mode, use the -d switch instead of -i.
Also consider using --restart=always to run the container continously when running in production.
NOTE:
The string HOST_IP in the vhost.conf file will be automatically replaced with the ip address of the container's host.
Use the following command to generate an SSL certificate for a domain:
docker exec -i -t -u root MyProxyContainer bash -c "/home/administrator/ssl-cert-generate.sh MY_NEW_DOMAIN.com"
(you'll have to enter an e-mail when doing this for the first time)
Use the following command to renew all the existing certificates:
docker exec -i -t -u root MyProxyContainer bash -c "/home/administrator/ssl-renew.sh"
SUDO_PASSWD = Initializes the "administrator" user's password.
ROOT_PASSWD = Initializes the root password of UBUNTU
After making changes, installing software or changing startup.sh, save your own image by using the following command:
docker commit MyPhpContainer my_own_php_image:v1
See my source code on https://github.com/mbinnun/Dockers/tree/main/ubuntu-apache2-php-server
Content type
Image
Digest
Size
154.2 MB
Last updated
over 5 years ago
docker pull mbinunn/ubuntu_apache2_php_server