diff --git a/docker-compose-static.yaml b/docker-compose-static.yaml new file mode 100644 index 0000000..2bc77ab --- /dev/null +++ b/docker-compose-static.yaml @@ -0,0 +1,22 @@ +name: nginx_static +include: + - path: + - compose_extends/network.include.yaml + +services: + static_site: + extends: + file: compose_extends/docker-compose.base.yaml + service: reverse + build: + context: . + dockerfile: Dockerfiles/Dockerfile_staticsite + args: + CONT_IMG_VER: "v1.0.0" + volumes: + - "./ssl:/etc/nginx/ssl:ro" + ports: + - 80:80 + - 443:443 + networks: + - services diff --git a/nginx_configs/nginx_static.conf b/nginx_configs/nginx_static.conf new file mode 100644 index 0000000..cc5d5bf --- /dev/null +++ b/nginx_configs/nginx_static.conf @@ -0,0 +1,58 @@ +user nobody nogroup; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 24; +} + +http { + sendfile on; + tcp_nopush on; + types_hash_max_size 2048; + + client_max_body_size 16M; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; + ssl_prefer_server_ciphers on; + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log debug; + + gzip on; + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*.conf; + + server { + listen 80; + listen [::]:80; + server_name _; + return 301 https://$host$request_uri; + } + + server { + listen 443 ssl; + listen [::]:443 ssl; + http2 on; + + server_name _; + + ssl_certificate /etc/nginx/ssl/cert.pem; + ssl_certificate_key /etc/nginx/ssl/key.pem; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + include configuration/_includes.conf; + + location / { + root /var/www/html/; + index index.html; + try_files $uri $uri/ =404; + } + } + +}