ungleich-learning-circle/youngjin.han/dot-cdist/type/__my_nginx_site/manifest~

43 lines
864 B
Bash
Executable File

#!/bin/sh -e
nginx_config_dir="/etc/nginx/conf.d"
domain="$__object_id"
__directory /var/www/html/$domain \
--parents --mode 0644
require="__directory//var/www/html/$domain" \
__file /var/www/html/$domain/index.html \
--source - --mode 0644 << EOF
Hello Cdist!!!
EOF
__my_nginx
# configure nginx
require="__my_nginx" \
__file "$nginx_config_dir/${domain}.conf" \
--mode 0644 --source - << EOF
server {
listen 80;
listen [::]:80;
server_name $domain;
access_log /var/log/nginx/access.log;
client_max_body_size 256m;
location / {
root /var/www/html/$domain;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html/$domain;
}
}
EOF