From 6dffb976789650aff810eaffa5819e82f912a70c Mon Sep 17 00:00:00 2001 From: starnakin Date: Wed, 4 Oct 2023 10:01:11 -0400 Subject: [PATCH] init: nginx --- Makefile | 11 +++++++++++ srcs/docker-compose.yml | 6 ++++++ srcs/nginx/Dockerfile | 14 ++++++++++++++ srcs/nginx/nginx.conf | 22 ++++++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 Makefile create mode 100644 srcs/docker-compose.yml create mode 100644 srcs/nginx/Dockerfile create mode 100644 srcs/nginx/nginx.conf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6dde9c0 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +USERNAME = cchauvet + +all: up + +build: + docker build -t ${USERNAME}/nginx srcs/nginx/ + +run: + docker-compose up -d srcs/docker-compose.yml + +up: build run diff --git a/srcs/docker-compose.yml b/srcs/docker-compose.yml new file mode 100644 index 0000000..b0ecbb6 --- /dev/null +++ b/srcs/docker-compose.yml @@ -0,0 +1,6 @@ +services: + nginx: + image: cchauvet/nginx + build: nginx + ports: + - "443:443" diff --git a/srcs/nginx/Dockerfile b/srcs/nginx/Dockerfile new file mode 100644 index 0000000..4540691 --- /dev/null +++ b/srcs/nginx/Dockerfile @@ -0,0 +1,14 @@ +FROM alpine:3.18.4 + +RUN apk update +RUN apk add nginx + +RUN adduser -D -g 'www' www + +RUN mkdir /www +RUN chown -R www:www /var/lib/nginx +RUN chown -R www:www /www + +COPY nginx.conf /etc/nginx/nginx.conf + +ENTRYPOINT ["nginx"] diff --git a/srcs/nginx/nginx.conf b/srcs/nginx/nginx.conf new file mode 100644 index 0000000..2d0d9e0 --- /dev/null +++ b/srcs/nginx/nginx.conf @@ -0,0 +1,22 @@ +events +{ +} + +http +{ + server { + listen 443; # Port d'écoute HTTP par défaut + + server_name votre_domaine.com; # Remplacez par votre nom de domaine + + root /var/www/html; # Répertoire racine du site web + + index index.html; # Page d'index par défaut + + location / { + try_files $uri $uri/ =404; # Gère les requêtes pour les fichiers statiques + } + } +} + +daemon off;