#!/bin/sh

openssl req -x509 -sha256 -nodes -newkey rsa:4096 -days 365 \
    -keyout localhost.key -out localhost.crt \
    -subj "/CN=$DOMAIN_NAME/emailAddress=$ADMIN_EMAIL/C=FR/ST=Grand-Est/L=Mulhouse/O=42"

mkdir -p  /etc/ssl/nginx
openssl dhparam -out /etc/ssl/nginx/dh2048.pem 2048

sed -i s/example.com/$DOMAIN_NAME/g /etc/nginx/http.d/example.com.conf

exec nginx