Giter Site home page Giter Site logo

docker-apache-proxy's Introduction

Apache Proxy on Docker

Table of Contents

  1. Introduction
  2. Deploy
  3. Recommended
  4. SSL Support

Introduction

Apache web server like proxy to Docker.

Enable modules :

  • proxy
  • proxy_http
  • ssl

Deploy

  • First, create an data container to storage your web site configuration
docker create --name proxy-data --volume /opt/proxy-conf/:/opt/proxy-conf busybox /bin/true
  • Then, create proxy container with link data volume. By default, the data volume is mountend in /opt/proxy-conf. All configurations of this website in this directory will be activated
docker run --name apache-proxy --volumes-from proxy-data -p 80:80 -d diouxx/apache-proxy

Recommended

I recommanded to link also web site container. It's just my advice

docker run --name apache-proxy --link sitecontainer:sitecontainer --volumes-from proxy-data -p 80:80 -d diouxx/apache-proxy

And an exemple proxy configurations

<VirtualHost *:80>
	ServerName yoursite.domain.com

	ProxyPass "/" "http://sitecontainer/"
	ProxyPassReverse "/" "http://sitecontainer/"

</VirtualHost>

SSL Support

To use Apache proxy with HTTPS :

  • First, configure your virtual host with SSL support

If you can use together HTTP and HTTPS port

<VirtualHost *:80>
        ServerName yoursite.domain.com

        ProxyPass "/" "http://sitecontainer/"
        ProxyPassReverse "/" "http://sitecontainer/"

</VirtualHost>

<VirtualHost *:443>
        ServerName yoursite.domain.com

        SSLEngine On

        SSLCertificateFile /opt/ssl/yourcertificate.crt
        SSLCertificateKeyFile /opt/ssl/yourcertificate.key

        SSLProxyEngine on

        <Location />
                ProxyPass / http://sitecontainer/
                ProxyPassReverse / http://sitecontainer/
        </Location>

</VirtualHost>

If you can user only HTTPS port and force redirect

<VirtualHost *:80>
	ServerName yoursite.domain.com

	Redirect permanent / https://yoursite.domain.com/
</VirtualHost>

<VirtualHost *:443>
        ServerName yoursite.domain.com
	
        SSLEngine On

        SSLCertificateFile /opt/ssl/yourcertificate.crt
        SSLCertificateKeyFile /opt/ssl/yourcertificate.key

	SSLProxyEngine on
	
	<Location />
        	ProxyPass http://sitecontainer/
        	ProxyPassReverse http://sitecontainer/
	</Location>

</VirtualHost>
  • Then, link your SSL certificate folder by volumes. Example :
docker run --name apache-proxy --volumes yourssldirectory:/opt/ssl/ --volumes-from proxy-data -p 80:80 -p 443:443 -d diouxx/apache-proxy

docker-apache-proxy's People

Contributors

diouxx avatar retzero avatar

Watchers

James Cloos 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.