Coder Social home page Coder Social logo

docker-apache-boilerplate's Introduction

Docker apache Setup

This is a boilerplate docker ssl apache setup. It will copy the redirect.apache.conf file to the docker container.

SSL Certificate setup

The certificate must be obtained for the virtual machine. First redirect the host address to the machines public IP Then follow the instructions below.

run ./cert_setup/certSetup.sh

or...

We need to run certbot setup using the certbot docker container

  • First set the env vars export [email protected] && HOST_NAME=yourhostname.com
  • In certbot directory
  • docker build --rm -t docker-apache2:cert .
  • docker run -d -p 80:80 -v "/home/$USER/certbot/$HOST_NAME/root:/var/www/html" docker-apache2:cert
  • Then run certbot:
EMAIL=<EMAIL> && HOST_NAME=<HOST_NAME> &&
docker run -it --rm --name certbot \
  -v "/home/$USER/certbot/conf:/etc/letsencrypt" \
  -v "/home/$USER/certbot/www:/var/www/certbot" \
  -v "/home/$USER/certbot/$HOST_NAME/root:/var/www/html" \
  certbot/certbot \
  certonly --webroot --email $EMAIL --agree-tos -d $HOST_NAME
# Webroot is /var/www/html
  • Set file access to /home/$USER/certbot/conf to allow apache server access
    • get Apache server UID by attaching a shell to the apache docker docker exec -it <container name> /bin/bash
    • and running id normally 0
    • sudo chown -R <UID>:<UID> /home/$USER/certbot/conf
    • Stop all running containers. You can also cleanup the docker containers as they are no longer needed.
    • You can now run the apache docker contaner via docker compose or continue to steps below to run manually
    • Then re build docker-apache2
      • docker build --rm -t docker-apache2:latest .
      • docker run -p 443:443 -e HOST_NAME=$HOST_NAME -e PROXYCLIENTNAME=node_server -v "/home/$USER/certbot/conf:/etc/letsencrypt" docker-apache2

docker-apache-boilerplate's People

Contributors

sbland avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.