Install Joomla Image

Clone the joomla-docker repo
$ git clone https://github.com/psd401/joomla-docker

Build the docker image

$ cd joomla-docker
$ docker built -t . psd/joomla 

Create the directory for your files to live. We need a vhosts directory and a sites directory for nginx.

mkdir joomla-site  
mkdir joomla-site/vhosts  
mkdir joomla-site/sites  

Create a docker compose file

cd joomla-site  
vim docker-compose.yml  

Place an itteration of the following in your compose file

joomla:  
  image: psd/joomla
  ports:
    - "5515:80"
  container_name: site_name
  volumes:
    - ./vhosts:/var/www/vhosts/:rw
    - ./sites:/etc/nginx/sites-available:rw
  command: setup-joomla
  environment:
    - SERVER_NAME=site.psd401.net

Run Joomla Container

Run docker-compose up -d (-d deamonizes the container allowing you to do other bashy things while it runs in the background)

Running a docker ps should show you your new container running with the options specified in the docker compose file.

If you look into your vhosts and sites folders, you should see joomla files inside the subfolder named after your site. Running wget localhost:5515 (Or whatever port you specified) should give you an index.html of the Joomla installation screen.

Setup Nginx load balancer

Now ssh into the load balancer running nginx. This will be your forward facing server that will pass web traffic to your joomla instance.

Navigate to Nginx configuration folder
cd /etc/nginx/sites-available

Create a new config
vim site.psd401.net

Paste in an itteration of the following

server {  
  listen 80;
  server_name site.psd401.net;
  rewrite ^/(.*) https://site.psd401.net/$1 permanent;
}


server {  
  listen 443 ssl;
  server_name site.psd401.net;

  location / {
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
    add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    dav_methods PUT DELETE;
    proxy_set_header HOST $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_pass http://vmnocwsdocker04.peninsula.wednet.edu:5515;
    fastcgi_read_timeout 60000;
    fastcgi_send_timeout 60000;
    send_timeout 60000;
    proxy_read_timeout 60000;
    proxy_send_timeout 60000;
  }
}

Note that the port nginx is passing to must match the port specified in the docker-compose file.