bundles/nginx: add nginx config

This commit is contained in:
Franzi 2020-04-13 09:52:26 +02:00
parent 411d22d404
commit ffb962b108
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 76 additions and 1 deletions

View file

@ -0,0 +1,35 @@
user www-data;
worker_processes ${worker_processes};
pid /var/run/nginx.pid;
events {
worker_connections ${worker_connections};
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
charset UTF-8;
override_charset on;
sendfile on;
#tcp_nopush on;
keepalive_timeout 15;
client_body_timeout 12;
client_header_timeout 12;
send_timeout 10;
access_log off;
error_log off;
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
include /etc/nginx/sites/*;
}

View file

@ -0,0 +1,13 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
return 301 https://$host$request_uri;
}
location /.well-known/acme-challenge/ {
alias /var/www/default/.well-known/acme-challenge/;
}
}

23
bundles/nginx/items.py Normal file
View file

@ -0,0 +1,23 @@
files = {
'/etc/nginx/nginx.conf': {
'content_type': 'mako',
'context': node.metadata['nginx'],
'triggers': {
'svc_systemd:nginx:restart',
},
},
'/etc/nginx/sites/000-port80.conf': {
'source': 'port80.conf',
'triggers': {
'svc_systemd:nginx:restart',
},
},
}
svc_systemd = {
'nginx': {
'needs': {
'pkg_apt:nginx',
},
},
}

View file

@ -1,5 +1,5 @@
@metadata_processor
def nginx_apt_repo(metadata):
def defaults(metadata):
return {
'apt': {
'repos': {
@ -19,4 +19,8 @@ def nginx_apt_repo(metadata):
'nginx': {},
},
},
'nginx': {
'worker_processes': 4,
'worker_connections': 1000,
},
}, DEFAULTS, DONE