Ports 80 (http) and 443 (https) have been forwarded from your external ip to an internal server at 10.1.1.2 which will handle the reverse proxy and SSL/TLS work using letsencrypt You have other application web servers listening on port 80 on your internal LAN at 10.1.1.11 and 10.1.1.12 but these are not accessible from outside your network. In order to define a HTTPS reverse proxy you will need to configure Apache to handle HTTPS requests. You can see how to do this here. The following examples rely on this configuration. The HTTPS reverse proxy definitions are similar to those seen previously, with the addition of the SSL related parameters. Often mapping different URL paths in a reverse proxy, / to /mycorp, leads to incompatibilities, as do unbalanced trailing slashes. That redirects requests for the root, the bare subdomain to the correct sub directory and also insures to for instance content from shared, not company specific, directories such as https://mycorp-xpqa-lb-8qh7ip0n.cms. Enabling HTTP Reverse Proxy¶ To enable HTTP reverse proxy: Edit proxy.config.reverseproxy.enabled in records.config.
In this post, we are going to see how to use docker httpd image and extend it to suit our needs and run the Apache web server as a Docker container.
We are also going to implement a docker reverse proxy as an additional example
Since we have targeted this post for Docker and Apache Installation and Configuration. We did not cover the fundamentals and basic components about Reverse Proxy but you can read, what is reverse proxy and how it is being configured in Traditional Apache Webserver in this link
I presume now you have understood what is Reverse Proxy and How it is working and configured in Traditonal and Normal Apache HTTPD Server environment.
Now let us move forward to the Docker Apache Image Creation and Reverse Proxy setup.
- Choose the HTTPD Image from DockerHub (or) Optionally Download the image to Local
- Write Dockerfile and Use the Standard HTTPD image then Expand and Customize it.
- Create a Local httpd.conf file and Enable the modules you need
- Build and Create an Image using the Dockerfile
- Create Configuration and HTML files to feed the Container
- Create a WorkSpace
- Create two Directories named
htmlfilesto have conf and html files respectively
- Create Virtual Host configuration file
- Create Html files under
- Start the Container from your Apache HTTPD Docker Image with Necassary Volumes and Port forwarding.
- Access the URL and Validate the Reverse Proxy
Step1: Choose the HTTPD Image from DockerHub (Download the Image)
Let us choose the Official Apache HTTPD Latest image and also download it to local using
docker pull CLI command
in your master server where you are running the
Docker Container Engine (CE) use the docker pull command like this
In fact, you do not have to explicitely mention the word
latest here. If you just mention
httpd the latest image would be picked up.
Note*: You can make sure the image is downloaded or not using the
docker images CLI command
Step2: Dockerfile to Create a Customized HTTPD Image
Now there might be a question, Why can’t we use the httpd image as it is ?
The Answer is, The downloaded standard
httpd image would have very minimal number of modules enabled. In order to implement reverse proxy we need to enable few modules like mod_proxy, mod_slotmem_shm, mod_watchdog etc.
Also, we need to enable the Support for our customized Virtual Host file and HTML files in the Container before we create it, Later during the startup time we can supply these (conf,html) files to the container
Here is the Docker file with self-descriptive comments for each line.
Step2a: Take the Standard httpd.conf file for apache2 and enable the modules you need
I have downloaded the standard
httpd.conf file and enabled the necassary modules like
Copy the Content from the aforementioned link and create a file named
httpd.conf in the same Directory where the
Dockerfile is located.
If you look at our customized
httpd.conf we have also added a Directive named
IncludeOptional to add a directory of configuration where our Virtual Host conf files can be placed.
*.conf files placed in this directory would be considered by Apache HTTPD
If you scroll back and look at our Dockerfile once again you can see that we are creating this directory
sites directory is our Dedicated configuration files location where we can place our Virtual Host conf files
Step3: Build and Create an Image from the Dockerfile
In the Same Directory where our Dockerfile and httpd.conf file is present. Execute the following command
Now the Image is ready and available in your Local Images Repository and the image name is
Step4: Create the Configuration files and Directories( Virtual Host and Html files)
Now we are going to create our Virtual Host (A WebSite) configuration file and it will be loaded into the container when it is being started.
It is not recommended to Share a Single file between Container and the Local Server. You always can share a Directory as a volume between a Container and a Host.
So we are going to create two new directories to keep our HTML and Conf files respectively and we are going to mount these directories as a Volume inside the container.
We will see how to do that in a minute.
Step 4a: Create a WorkSpace
Now choose some directory in your local system ( Mac/Windows) where Docker Container Engine is running and Let us call it as a workspace in my case it is /apps/docker/apacheconf
Step 4b: Create two Directories to place html and conf files
Create two Directories under the workspace to keep the virtualhost conf and html files.
Step 4c: Create Virtual Host configuration file under sites directory
Now go inside the sites directory and Create a Virtualhost configuration file ( A WebSite). If you have a Virtualhost file of your choice please use that or if you are following along, Please copy the following content and Save it as
Step 4d: Create the html file under htmlfiles directory
Save the following content into a file named index.html under the htmlfiles directory
Step5: Start the docker httpd Container with Volumes and Port Forwarding
Volumes – is a Docker terminology, It helps you Mount the local file system [directory] inside the container as a volume
PortForwarding – Forward the Container Port to host
--publish : to forward the container port 80 to Mac/Windows host’s port 90
-d : to run the container in background, Detached mode
--name: Name the container as apache server
-v : The Volume Mapping. Mounting the Host’s
/usr/local/apache2/conf/sites inside the container
Now you can understand, that the directories we have created in local workspace are mounted inside the container and being used
In fact the Html and the configuration files we have placed in
htmlfiles directory on the local are now being used by the container and our website
techolaf.com is ready
Note*: Before validating the Site. You need to be aware the ServerName specified in the configuration file is techolaf.com and Apache would look for this name on the Address bar when you try to reach the website.
In enterprise these things are managed with internal DNS servers. For testing you can use your /etc/hosts file
Make an entry in your /etc/hosts file like shown below
Now you are all set!.
Video conferencing systems. Amazon Chime is a modern, fully-managed communications service from AWS that delivers frustration-free video conferencing. With Amazon Chime, you can join video conferences from an in-room video system, mobile phone, or your desktop, both inside and outside your organization. Nextiva offers Amazon Chime video conferencing and screen sharing as part of its suite of connected communications solutions, allowing businesses to stay connected while working from anywhere. Amazon Interactive Video Service can make new live video available to viewers in seconds, and is ideal for use cases that need new streams within a moment’s notice. With the low-latency live video so simple to use, you can focus on building engaging interactive experiences and applications. Engage your audiences with social chat.
Step6: Validate the Reverse Proxy
I hope you have your DNS records corrected.
With that assumption, let us go and hit the url
The Configured and Desired result is when you try with no URI (or) the Home URL you should get the welcome html page you have created and when you are using the URI
mwi it should load the content of our
www.middlewareinventory.com website home page.
Apache Reverse Proxy Https To Http
The Home Page [ Welcome html ]
The Reverse proxy Page with URI
I know there are lot of steps in here. But if you follow along you can get it done very easily.
Try it and let me know if you get any issues and feel free to comment for any help or support
Rate this article [ratings]
Apache Reverse Proxy Http To Https Gmail
Follow us on Facebook or Twitter
For more practical videos and tutorials. Subscribe to our channel
Find me on Linkedin My Profile
For any Consultation or to hire us [email protected]
If you like this article. Show your Support! Buy me a Coffee.
Httpd Reverse Proxy
Signup for Exclusive 'Subscriber-only' Content
More from Middleware Inventory
- Apache Reverse Proxy - What is it and How to Configure Reverse Proxy
Introduction Proxy, In general terms it means 'a person who is authorized to act for another'. In Server infrastructure, a Proxy Server do the same thing, It stands in for some other server, which should be kept away and hidden for so many reasons. Proxy servers are used for both legal…
- Docker Run Image as Container - Create Container From Docker Image
In this post, we are going to see how to create an image and run the image as a container and manage it. Before we proceed further, it is indispensable, that we are aware of what is an Image and What is a Container. So let us begin from there.…
- Apache Webserver Basic Authentication using htpasswd - How to
Overview To Secure the Apache Virtualhost (or) a particular document root /directory. We can use this Basic Auth mechanism. When the user is trying to access the resource from the directory. User will be prompted for Authentication. Step1 Create a Password file with username and password entry using htpasswd tool. Available…
- Docker Weblogic : Run Oracle Weblogic 12c on Docker
The Introduction to Docker Weblogic In this post, we are going to be exploring the quick and easy option available to get started with weblogic and Docker. In this post, we are going to see how to create a weblogic container in docker in a few easy steps. The post's…
- Docker Tomcat Example - Dockerfile for Tomcat, Docker Tomcat Image
In this post, we are going to learn how to install a Tomcat Application Server or Web Container on Docker and Deploy web applications into the Tomcat running inside Docker. This post is all about Docker Tomcat and deploying war web application into tomcat docker, Sample Docker Tomcat image, Dockerfile…