Coder Social home page Coder Social logo

nginx-virtual-host-docker-container's Introduction

Nginx-Virtual-Host-Docker-Container

Followed Links -

https://dolphinandmermaids.com/blog/docker-nginx-letsencrypt/ * https://www.bogotobogo.com/DevOps/Docker/Docker-Compose-Nginx-Reverse-Proxy-Multiple-Containers.php https://gist.github.com/morgangiraud/9c49d596991dbb47be6b52bfa3bce862

Task - Nginx virtual hosting inside docker container - with SSL

Create DockerFile for Nginx -

FROM nginx:alpine COPY nginx.conf /etc/nginx/nginx.conf

After that we create a docker-compose file -

Let’s start by creating our main Docker Compose file, that will launch our nginx proxy and Let’s Encrypt companion containers. In a separate folder called proxy create file docker-compose.yml with contents below:

version: '3' # Version of the Docker Compose file format services:

webserver: build: . container_name: webserver restart: on-failure tty: true ports: - "80:80" - "81:81" - "443:443" volumes: - ./sites/:/usr/share/nginx/html - ./demoone/:/usr/share/nginx/html/demoone - ./ssl/:/etc/ssl


Command -

docker-compose build

docker-compose up -d

Docker Compose will look for a file named docker-compose.yml in the current folder and launch all services (containers) that are described in there. In this case it will launch nginx proxy and Let’s Encrypt companion containers. Also, because we trying to launch it for the first time it will build images first. Flag -d means that we want to run our containers in the background (detached mode).


Use the following command to check containers status:

docker ps

nginx-virtual-host-docker-container's People

Contributors

ganeshpawarnsk117 avatar

Watchers

 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.