Skip to content

gh640/docker-compose-depends_on-nginx-certs-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

A sample that runs NGINX with a self-signed certificate

This is a sample Docker Compose configuration to run an NGINX server with a self-signed certificate.

Requirements

  • Docker
  • Docker Compose >=1.29.0

Usage

Build images and run containers.

docker compose build
docker compose up -d

You can check the NGINX server runs with a self-signed certificate.

curl --insecure \
    --resolve 'example.local:443:127.0.0.1' \
    https://example.local
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Hello</title>
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            font-family: sans-serif;
        }
        .bodywrapper {
            width: 100vw;
            height: 100vh;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            background-color: #f4f8f8;
        }
    </style>
</head>
<body>
    <div class="bodywrapper">
        <h1>Hello.</h1>
    </div>
</body>
</html>

Stop containers and remove resources after you've finished.

docker compose down

References