n'importe tu sais: nginx

This commit is contained in:
starnakin 2023-10-05 09:45:59 -04:00
parent 6c6032585f
commit d012f6db49
4 changed files with 26 additions and 34 deletions

View File

@ -1,11 +1,13 @@
USERNAME = cchauvet
all: up
build:
docker build -t ${USERNAME}/nginx srcs/nginx/
run:
docker-compose up -d srcs/docker-compose.yml
docker-compose -f srcs/docker-compose.yml up --build -d
up: build run
fclean:
-docker rm -f `docker ps -aq`
-docker volume rm -f `docker volume ls -q`
-docker image rm -f `docker image ls -aq`
-docker network rm -f `docker network ls -q`
-docker builder prune --all --force
up: run

View File

@ -1,6 +1,6 @@
services:
nginx:
image: cchauvet/nginx
image: nginx
build: nginx
ports:
- "443:443"

View File

@ -8,6 +8,6 @@ RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-out /etc/ssl/certs/nginx-selfsigned.crt \
-subj "/C=FR/ST=Nouvelle Aquitaine/L=Angouleme/O=42 Angouleme/CN=cchauvet.42.fr"
COPY nginx.conf /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/http.d/default.conf
ENTRYPOINT ["nginx"]
ENTRYPOINT ["nginx", "-g", "daemon off;"]

View File

@ -1,25 +1,15 @@
events
{
server {
listen 443 ssl;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
http
{
server {
listen 443; # Port d'écoute HTTP par défaut
ssl_protocols TLSv1.2 TLSv1.3;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
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;