This project runs Nginx in a Docker container using Hyperbola GNU/Linux-libre to serve static web content.
.
├── docker-compose.yml
├── nginx/
│ └── default.conf
└── html/
└── index.html
To start the service:
docker-compose up
Then access the web server at:
http://localhost:8080
docker-compose.ymlversion: '3.8'
services:
hyperbola-nginx:
image: docker.io/rusian/base-nginx:latest
ports:
- "8080:80"
volumes:
- ./html:/usr/share/nginx/html # Mount the html directory for static content
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf # Mount custom nginx config
environment:
- NGINX_PORT=80
nginx/default.conf)Create a default.conf file inside the nginx/ directory with the following configuration:
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
autoindex on;
autoindex_exact_size off;
root /usr/share/nginx/html;
}
}
This configuration:
index.html is present in the /usr/share/nginx/html directory.html/index.htmlCreate a simple index.html file inside the html/ directory to verify the server is running:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hyperbola Nginx Server</title>
</head>
<body>
<h1>Hello from Hyperbola with Nginx in Docker!</h1>
</body>
</html>
To stop and remove the containers and network:
docker-compose down
nginx/default.conf and html/index.html files.docker-compose up to start the service.http://localhost:8080 to see the Nginx server serving static content.Content type
Image
Digest
sha256:1cbeab1e5…
Size
170.3 MB
Last updated
about 12 hours ago
docker pull rusian/base-nginx