init: nginx
This commit is contained in:
		
							
								
								
									
										11
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
			
		||||
							
								
								
									
										6
									
								
								srcs/docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								srcs/docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
services:
 | 
			
		||||
  nginx:
 | 
			
		||||
    image: cchauvet/nginx
 | 
			
		||||
    build: nginx
 | 
			
		||||
    ports:
 | 
			
		||||
      - "443:443"
 | 
			
		||||
							
								
								
									
										14
									
								
								srcs/nginx/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								srcs/nginx/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -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"]
 | 
			
		||||
							
								
								
									
										22
									
								
								srcs/nginx/nginx.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								srcs/nginx/nginx.conf
									
									
									
									
									
										Normal file
									
								
							@ -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;
 | 
			
		||||
		Reference in New Issue
	
	Block a user