Quick file serving with lightweight & efficient webserver using nginx:1.25-alpine
Quick project aims to demonstrate the creation, deployment of a lightweight & efficient web server using Nginx running on an Apline Linux based Docker container. The project serve static files from any mounted folder, making an ideal solution for hosting simple website, front-end applications, or any content that needs to be served from a folder / local system.
- Container name
CNAME=nginx-8080
- Nginx image is used from dockerhub
build
folder in current directory is mounted-v "$(pwd)"/build:/usr/share/nginx/html
- Any changes in the local folder
build
will automatically be updated & served by nginx
- Create a folder
build
bymkdir build
- Create
index.html
in the o - Start the nginx container
sh nginx-serve.sh
- Stop & remove the container
sh clean.sh
- Login into the container
docker exec -it nginx-8080 /bin/sh
- Try opening http://localhost:8080 in browser
- Stop and remove the container
- You can also remove the image
docker rm -f nginx:1.25-alpine
By Samar Panda