First Upate System:
$ sudo apt update
$ sudo apt upgrade -y
Install Apache:
$ sudo apt install -y apache2
Install build-essential:
$ sudo apt install -y build-essential
Install dependacies:
$ sudo apt install -y libapache2-mod-proxy-html libxml2-dev
Install Lego to setup Letsencypt Certificates (if you want SSL)
$ cd /tmp
$ curl -Ls https://api.github.com/repos/xenolf/lego/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4 | wget -i -
$ tar xf lego_vX.Y.Z_linux_amd64.tar.gz
$ sudo mkdir -p /home/user/cloud/letsencrypt
$ sudo mv lego /home/user/cloud/letsencrypt/lego
$ rm lego_vX.Y.Z_linux_amd64.tar.gz
readmore...
Configure Apache:
$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo a2enmod proxy_ajp
$ sudo a2enmod rewrite
$ sudo a2enmod deflate
$ sudo a2enmod headers
$ sudo a2enmod ssl
$ sudo a2enmod proxy_balancer
$ sudo a2enmod proxy_connect
$ sudo a2enmod proxy_html
Add the local.conf (details) to the correct path:
$ sudo nano /etc/apache2/sites-available/local.conf
OR Add the local-ssl.conf (details) to the correct path:
$ sudo nano /etc/apache2/sites-available/local-ssl.conf
Turn off the default website:
$ sudo a2dissite 000-default.conf
Turn on the local configurations:
$ sudo a2ensite local.conf
OR Turn on the local configurations:
$ sudo a2ensite local-ssl.conf
Setup the SSL with your docker container?
Depends on where in the container your application will get the keys.
Usually mounting files directly from the /home/user/cloud/letsencrypt/certificates
folder, into your comtainer via the docker-compose.yml file will do.
Example:
volumes:
- '/home/user/cloud/letsencrypt/certificates/jcb.yourdomain.com.crt:/opt/bitnami/apache/conf/server.crt'
- '/home/user/cloud/letsencrypt/certificates/jcb.yourdomain.com.key:/opt/bitnami/apache/conf/server.key'
readmore...
Restart Apache:
$ sudo service apache2 restart
That is all that is needed, you can add more proxies to the local.conf
as needed, and just reload Apache each time.
@Llewellynvdm
The correct path to add
local.conf
is in the /etc/apache2/sites-available
directory instead of /etc/apache2/sites-enabled