Initial Commit

This commit is contained in:
Christer Warén
2024-05-05 18:10:54 +03:00
commit 923312b782
16 changed files with 693 additions and 0 deletions

5
files/certbot/nginx.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo -n "$CERTBOT_VALIDATION" > /root/nginx/html/.well-known/acme-challenge/$CERTBOT_TOKEN
mkdir -p /root/nginx/html/.well-known/acme-challenge
/opt/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/mkj-infra --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/id_rsa tasks.yml -t nginx &> /dev/null

View File

@ -0,0 +1,81 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
expires off;
etag off;
if_modified_since off;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types *;
gunzip on;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
return 301 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
root /usr/share/nginx/html;
index index.html index.htm;
}
if ($request_method !~ ^(GET|HEAD|POST)$ )
{
return 405;
}
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name _;
http2 on;
ssl_certificate /etc/nginx/certs/mkj/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/mkj/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES256-CCM8:DHE-RSA-AES256-CCM:ECDHE-ARIA256-GCM-SHA384:DHE-RSA-ARIA256-GCM-SHA384:ECDHE-ARIA128-GCM-SHA256:DHE-RSA-ARIA128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-CCM8:DHE-RSA-AES128-CCM';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/certs/mkj/chain.pem;
expires off;
etag off;
if_modified_since off;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types *;
gunzip on;
client_max_body_size 256M;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE)$ )
{
return 405;
}
}

31
files/nginx/config.conf Normal file
View File

@ -0,0 +1,31 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log error;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '[$time_local] $host - $remote_addr - $remote_user "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
server_tokens off;
sendfile off;
#tcp_nopush on;
keepalive_timeout 65;
resolver 1.1.1.1;
include /etc/nginx/conf.d/*.conf;
}