This is a sample Docker Compose configuration to run an NGINX server with a self-signed certificate.
- Docker
- Docker Compose
>=1.29.0
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