maj readme
This commit is contained in:
		
							parent
							
								
									e5f43e6051
								
							
						
					
					
						commit
						d5b72a8970
					
				| @ -1,7 +1,6 @@ | |||||||
| FROM nginx:alpine | FROM nginx:alpine | ||||||
|  | 
 | ||||||
| COPY ./public /var/www/html | COPY ./public /var/www/html | ||||||
|   |  | ||||||
| # Literally copy nginx.conf file from the Dockerfile directory into /etc/nginx/conf.d/default.conf of the container |  | ||||||
| COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf | COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf | ||||||
| 
 | 
 | ||||||
| EXPOSE 80 | EXPOSE 80 | ||||||
|  | |||||||
							
								
								
									
										68
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								README.md
									
									
									
									
									
								
							| @ -3,15 +3,51 @@ | |||||||
| Cette branche à pour but de conteneurisé un site HUGO compilé avec un server NGINX. | Cette branche à pour but de conteneurisé un site HUGO compilé avec un server NGINX. | ||||||
| La configuration pour le NGINX reverse proxy en front se trouve dans le dossir nginx-proxy. | La configuration pour le NGINX reverse proxy en front se trouve dans le dossir nginx-proxy. | ||||||
| 
 | 
 | ||||||
| ## CONFIG | ## UTILISATION: | ||||||
| 
 | 
 | ||||||
|  | Pour l'utiliser avec un autre site Hugo, copier simplement la Dockerfile ou le docker-compose.yml | ||||||
|  | ainsi que les dossiers nginx-docker et nginx-proxy à la racine du projet Hugo (à côté du config.toml) | ||||||
|  | et éxécuter la commande pour construire le site: | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | hugo | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Un dossier public s'est créé avec les fichiers statiques du site, il faut maintenant configurer | ||||||
|  | les Nginx (le proxy et celui dans l'image Docker: | ||||||
|  | 
 | ||||||
|  | ## CONFIGURATION: | ||||||
|  | 
 | ||||||
|  | Editer le fichier de configuration | ||||||
| ```bash | ```bash | ||||||
| nano nginx-proxy/nginx.conf | nano nginx-proxy/nginx.conf | ||||||
| ``` | ``` | ||||||
|   |   | ||||||
| /\ Attention, le nom de domaine est à configuré dans le proxy NGINX ! | /\ Attention, le nom de domaine (ici exemple.com) est à configuré dans le proxy NGINX ! | ||||||
|  | Une fois tout bien renseigné | ||||||
| 
 | 
 | ||||||
| ### Pour le HTTPS: | Redémarrer NGINX: | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | sudo systemctl restart nginx | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ## DEMARRER L'IMAGE: | ||||||
|  | 
 | ||||||
|  | ### VIA DOCKER  | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | docker build -t hugo/hugo-site . | ||||||
|  | docker run -d -p 6666:80 --name hugo-site hugo/hugo-site | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### VIA DOCKER-COMPOSE | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | docker-compose up -d | ||||||
|  | ```  | ||||||
|  | 
 | ||||||
|  | ### HTTPS: | ||||||
| 
 | 
 | ||||||
| Via Certbot: | Via Certbot: | ||||||
| ```bash | ```bash | ||||||
| @ -26,30 +62,8 @@ le nom des certificats en fonction du nom de domaine: | |||||||
|    #ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; |    #ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; | ||||||
|    #ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; |    #ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; | ||||||
| ``` | ``` | ||||||
|  | Créer une redirection vers le HTTPS dans le bloc server HTTP: | ||||||
| 
 | 
 | ||||||
| Redémarrer NGINX: |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| sudo systemctl restart nginx |  | ||||||
| ``` | ``` | ||||||
| 
 | return 301 https://$host$request_uri; | ||||||
| ## BUILD |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| hugo |  | ||||||
| ``` | ``` | ||||||
| 
 |  | ||||||
| ## START |  | ||||||
| 
 |  | ||||||
| ### DOCKER |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| docker build -t hugo/hugo-site . |  | ||||||
| docker run -d -p 6666:80 --name hugo-site hugo/hugo-site |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| ### DOCKER-COMPOSE |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| docker-compose up -d |  | ||||||
| ```  |  | ||||||
|  | |||||||
| @ -8,10 +8,25 @@ server { | |||||||
|     client_max_body_size 64M; |     client_max_body_size 64M; | ||||||
| 
 | 
 | ||||||
|     # Redirection HTTP -> HTTPS |     # Redirection HTTP -> HTTPS | ||||||
|     return 301 https://$host$request_uri; |     #return 301 https://$host$request_uri; | ||||||
| 
 | 
 | ||||||
|  |    location / { | ||||||
|  |       proxy_buffering off; | ||||||
|  |       proxy_redirect off; | ||||||
|  |       proxy_set_header Host $host; | ||||||
|  |       proxy_set_header X-Real-IP $remote_addr; | ||||||
|  |       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||||||
|  |       proxy_set_header X-Forwarded-Host $server_name; | ||||||
|  |       proxy_set_header X-Forwarded-Proto $scheme; | ||||||
|  |       proxy_pass http://127.0.0.1:6666; | ||||||
|  |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |    # Nécessaire pour les redirections internes à Hugo | ||||||
|  |    location /feed { | ||||||
|  |        return 302 https://example.com/index.xml; | ||||||
|  |    } | ||||||
|  | 
 | ||||||
| # HTTPS | # HTTPS | ||||||
| server{ | server{ | ||||||
|    listen 443 ssl http2; |    listen 443 ssl http2; | ||||||
| @ -30,7 +45,7 @@ server{ | |||||||
|       proxy_pass http://127.0.0.1:6666; |       proxy_pass http://127.0.0.1:6666; | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    # Nécessaire pour les redirections inetrnes à Hugo |    # Nécessaire pour les redirections internes à Hugo | ||||||
|    location /feed { |    location /feed { | ||||||
|        return 302 https://example.com/index.xml; |        return 302 https://example.com/index.xml; | ||||||
|    } |    } | ||||||
| @ -41,5 +56,4 @@ server{ | |||||||
| 
 | 
 | ||||||
|    access_log /var/log/nginx/hugo_access.log; |    access_log /var/log/nginx/hugo_access.log; | ||||||
|    error_log /var/log/nginx/hugo_error.log; |    error_log /var/log/nginx/hugo_error.log; | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	